Logo-small

3.3.1 Socket

Socket is one of the main networking classes. You can create a new TCP socket with the message #newTCP.

This example creates a TCP socket and puts it into listening mode. After a client has connected, it reads data from the socket.

| server client |
server := Socket newTCP.
server listenOn: 12345 backlogSize: 4.
server waitForConnectionFor: 600.
client := server accept.
client receiveData

Add a Note

Licensed under Creative Commons BY-NC-SA | Published using Pier |