[Pharo-project] Socket listenOn: 0 & accept

Sven Van Caekenberghe sven at beta9.be
Fri Mar 9 12:44:50 EST 2012

On 09 Mar 2012, at 16:56, Philippe Marschall wrote:

> On 03/09/2012 04:44 PM, Sven Van Caekenberghe wrote:
>> Most socket API's allow for the creation of a server socket on the next available port, often by specifying 0 instead of a port. When the socket is bound, one can retrieve the local port and let the client(s) know. I tried to do that in Pharo today, and these steps seem to work, by accepting an incoming connection gives a primitive failed.
> Stupid n00b question, isn't 0 a valid port number?

I don't think so, in Java:



public ServerSocket (int port) throws IOException

Creates a server socket, bound to the specified port. A port of 0 creates a socket on any free port.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4334 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20120309/f092afa0/attachment.p7s>

More information about the Pharo-dev mailing list