Topic: APLX Help : System Classes : Methods : Accept
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

The 'Accept' method


Argument: None
Result: Integer Scalar

Valid for: Socket

This method should be called for a Socket object which is acting as a server. You first call the Listen method, which causes the underlying socket to be linked to a specific port. You then typically loop round calling the Accept method. This will cause your task to block until a remote client tries to connect to your socket (or until the timeout property has expired, if this is sooner). When the client connects, a new socket is created and linked to the client. The Accept method returns the handle of this new socket. Your APL application can then create a new Socket object, and write the returned handle to the handle property of the newly created object, which can then be used to communicate with the client. (You will probably want to create the new Socket object in a different APLX task, so that the main server task can loop round and wait for another client connection).

The return value from the Accept method is a positive integer if a client connected (this is the handle you should use for further communication). It is 0 if the method timed out or was interrupted. It is ¯1 if an error occurred.


Topic: APLX Help : System Classes : Methods : Accept
[ Previous | Next | Contents | Index | APL Home ]