I started looking at the Socket failures that I can reproduce and I can't wrap 
my head around the SocketReadingWritingTest>>setUp. Based on what I know about 
TCP sockets it doesn't make sense to me. AFAIK to get both ends of a connected 
TCP connection (lacking a socketpair call) I need 3 sockets. A listening 
socket, a client socket (doing connect) and finally the server socket that 
comes out as a result of accept on the listener. So I'd expect to see something 
like this in the setUp:

| data input output listener socket1 socket2 process sync |
Socket initializeNetwork.
sync := Semaphore new.
listener := Socket newTCP.
listener listenOn: 9999.
process := [ [ socket1 := listener accept ] ensure: [ listener close ]. sync 
signal ] fork.
socket2 := Socket newTCP.
socket2 connectTo: (NetNameResolver localHostAddress) port: 9999.
sync wait.
output := socket1 reading.
input := socket2 writing.

Surprisingly, the above doesn't work, while many of the Socket tests seem to 
pass for me despite my brain telling me that it can't possibly. Can anyone shed 
some light on this for me ?

Thanks,

Martin


Reply via email to