Experimenting with #sendUDPData:toHost:port:

Stefan Kersten kerstens at cs.tu-berlin.de
Wed Dec 13 09:05:56 UTC 2000

John M McIntosh wrote:
> UDP support is not missing at the Smalltalk level as far as I know, 
> since there are a bunch of UDP tests and no-one has complained and 
> offered up an ENH change set for UDP at the Smalltalk level. However 
> UDP support may be lacking in the VM you are using. There is some 
> work being done on Unix socket support, see the note below that Rob 
> Withers wrote about his version of sqUnixNetwork.c but note his note 
> about UDP support. Check his list message and email him, perhaps he 
> has a UDP version now?
[Rob Wither's message snipped]

Thanks a lot for the hint. I haven't tried to compile Rob Wither's code
yet (still being a little confused about the multitude of VM versions
apparently floating around at least for Unix). The little diff I
attached seems to fix the particular problem I had, however (applicable
to sqUnixSocket.c in Ian Piumarta's 2.8 VM).

I came around another issue, which I recall was also reported by the
original poster: the prinmitive


fails with a 'connection refused' errno when the server specified is not
up. Is this intended behavior for UDP sockets? If so, how would I
actually avoid primitiveFailed to be signalled, i.e. is there a way to
ensure the address's availability beforehand? In my application I'd like
to send some UDP data and simply do nothing if the packet fails to be

-------------- next part --------------
*** sqUnixSocket.c	2000/12/13 07:30:27	1.1
--- sqUnixSocket.c	2000/12/13 09:02:30
*** 1305,1310 ****
  			    (struct sockaddr *)&saddr,
  	if (nread >= 0)
! 	  return nread;
  	if (errno == EWOULDBLOCK)
--- 1305,1316 ----
  			    (struct sockaddr *)&saddr,
  	if (nread >= 0)
! 	  {
! 	    /* Store the return address */
! 	    *address= ntohl(saddr.sin_addr.s_addr);
! 	    *port= ntohs(saddr.sin_port);
! 	    return nread;
! 	  }
  	if (errno == EWOULDBLOCK)

More information about the Squeak-dev mailing list