Index | |
OzServer | |
Socket | |
CustomCompiler |
- Open
- System
- <P/3:MakeClient>
- <P/4:MakeServer>
- <P/3:ReadToStream>
- <P/2:Write>
proc{MakeClient Host PortNr MyClient}
Expects a portnumber and returns a client.
NB: This proc is only used for testing..
proc{MakeServer Host PortNo MyServer MyClient}
Creates a TCP socket server. Expects a Host (e.g., 'localhost') and a PortNo and returns a server plus its corresponding client. This client is an instance of Open.socket, and is the interface for reading and writing into the socket.
MakeServer blocks until the server listens. However, waiting until a connection has been accepted happens in its own thread (i.e. MakeServer does only block until the server listens).
NB: A port can be used only once, so assign it carefully. In case this postnnumber was shortly used before, you may need to wait a bit before reusing it.
proc{ReadToStream Socket Size Xs}
The socket Server returns a stream of the strings it receives. The Server always waits until someone writes something into the socket, then the input is immediately written to a stream and the Server waits again.
proc{Write Socket VS}