Problems with sockets on 3.7alpha #5423

Phil Hargett hargettp at mindspring.com
Mon Sep 29 00:51:26 UTC 2003


Uh, okay, novice mistake: apologies for bothering the list.

In case anyone cares, using the Unix SocketPlugin most definitely 
doesn't behave well with Mac OS X (or, at least the way I built it).  A 
quick review of the Project Builder project and a change to the Mac OS 
Socket Plugin (using sqMacNetwork.c), and suddenly the VM handles my 
code just fine.

Again, apologies.

On Sunday, September 28, 2003, at 12:05 PM, Phil Hargett wrote:

> 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