'From Squeak3.6beta of ''4 July 2003'' [latest update: #5373] on 1 September 2003 at 9:00:38 pm'! !OldSocket methodsFor: 'connection open/close' stamp: 'ikp 9/1/2003 20:47'! listenOn: portNumber backlogSize: backlog interface: ifAddr "Listen for a connection on the given port. If this method succeeds, #accept may be used to establish a new connection" | status | status _ self primSocketConnectionStatus: socketHandle. (status == Unconnected) ifFalse: [self error: 'Socket status must Unconnected before listening for a new connection']. self primSocket: socketHandle listenOn: portNumber backlogSize: backlog interface: ifAddr. ! ! !OldSocket methodsFor: 'primitives' stamp: 'ikp 9/1/2003 20:55'! primSocket: aHandle listenOn: portNumber backlogSize: backlog interface: ifAddr "Primitive. Set up the socket to listen on the given port. Will be used in conjunction with #accept only." self destroy. "Accept not supported so clean up"! ! !OldSocket class methodsFor: 'examples' stamp: 'ikp 9/1/2003 20:59'! remoteTestServerTCP "See remoteTestClientTCP for instructions on running this method." "OldSocket remoteTestServerTCP" | socket client buffer n | Transcript show: 'initializing network ... '. Socket initializeNetwork. Transcript show:'ok';cr. socket _ OldSocket newTCP. socket listenOn: 54321 backlogSize: 5 interface: (NetNameResolver addressFromString: '127.0.0.1'). "or: 0.0.0.0" Transcript show: 'server endpoint created -- run client test in other image'; cr. buffer _ String new: 4000. socket waitForConnectionUntil: self standardDeadline. client _ socket accept. [client isConnected] whileTrue: [ client dataAvailable ifTrue: [n _ client receiveDataInto: buffer. client sendData: buffer count: n]]. client closeAndDestroy. socket closeAndDestroy. Transcript cr; show: 'server endpoint destroyed'; cr. ^socket! ! !Socket methodsFor: 'connection open/close' stamp: 'ikp 9/1/2003 20:32'! listenOn: portNumber backlogSize: backlog interface: ifAddr "Listen for a connection on the given port. If this method succeeds, #accept may be used to establish a new connection" | status | status _ self primSocketConnectionStatus: socketHandle. (status == Unconnected) ifFalse: [InvalidSocketStatusException signal: 'Socket status must Unconnected before listening for a new connection']. self primSocket: socketHandle listenOn: portNumber backlogSize: backlog interface: ifAddr. ! ! !Socket methodsFor: 'primitives' stamp: 'ikp 9/1/2003 20:33'! primSocket: aHandle listenOn: portNumber backlogSize: backlog interface: ifAddr "Primitive. Set up the socket to listen on the given port. Will be used in conjunction with #accept only." self destroy. "Accept not supported so clean up"! !