Problems with sockets on 3.7alpha #5423
Phil Hargett
hargettp at mindspring.com
Sun Sep 28 16:05:44 UTC 2003
Currently using image 3.7alpha #5423, VM built from SourceForge sources
and running on Mac OSX.
Trying to do simple network programming: have a client open a socket
connection to a server (both Squeak processes, both in the same VM).
Client code goes something like this to open a connection:
machine := #(127 0 0 1) asByteArray.
port := 5131.
socket
ifNil: [socket := Socket newTCP.
socket connectTo: machine port: port.
socket waitForConnectionFor: timeout].
Server does something like this to listen for and accept inbound
connections:
port := 5131.
timeout := 10000.
serverSocket := Socket newTCP.
serverSocket listenOn: port backlogSize: 30.
clientSocket := serverSocket waitForAcceptFor: timeout ifTimedOut:
[nil].
What's very strange is that the client code thinks it's connected
(e.g., makes it through the segment of code above), but the server
never does. I am certain that I am starting my server code before the
client, so that it would be ready to receive incoming connections.
Further, I've modified my firewall on OS X to ensure the ports I'm
using are OK.
Please let me know if I'm using the wrong idiom to initiate
connections, or if you suspect that something deeper is going on. I
just spent some time running the VM in the Project Builder Debugger,
and it would almost seem that the acceptHandler() function in
sqUnixSocket.c is never called by the AIO subsystem--hence, there's not
notification that there is a socket to accept, so that the server code
can proceed.
Thanks!
More information about the Squeak-dev
mailing list
|