SIMPOL Documentation

When a Connection Occurs

When a client connects to the port on which the server is listening, SIMPOL makes a call to the function referred to by the function reference passed into the listen() method. The function must defined with the following prototype:

funcname ( tcpsocket connectionname, type(*) user-defined-type )

The first parameter is the tcpsocket object representing the connection from the caller and the second is the optional user-defined object (this can be .nul). Each connection will begin a new thread that starts by calling the function reference passed to the listen() method. The conversation with the caller then takes place in exactly the same way that a conversation would take place in a client application (see the previous chapter for details). When the function ends then the thread will also end.