[Vm-dev] Multiple images listening on same TCP port
John M McIntosh
johnmci at smalltalkconsulting.com
Tue Jun 9 16:53:18 UTC 2009
Ok, I assume you did
> s := Socket newTCP.
> s listenOn: 7777.
in both images.
Yes Unix will allow that, this is not a squeak vm issue,
Check the socket options to see if any apply to your needs of
preventing two apps from acquiring the same socket
at the same time.
static socketOption socketOptions[]= {
{ "SO_DEBUG", SOL_SOCKET, SO_DEBUG },
{ "SO_REUSEADDR", SOL_SOCKET, SO_REUSEADDR },
{ "SO_DONTROUTE", SOL_SOCKET, SO_DONTROUTE },
{ "SO_BROADCAST", SOL_SOCKET, SO_BROADCAST },
{ "SO_SNDBUF", SOL_SOCKET, SO_SNDBUF },
{ "SO_RCVBUF", SOL_SOCKET, SO_RCVBUF },
{ "SO_KEEPALIVE", SOL_SOCKET, SO_KEEPALIVE },
{ "SO_OOBINLINE", SOL_SOCKET, SO_OOBINLINE },
{ "SO_LINGER", SOL_SOCKET, SO_LINGER },
{ "IP_TTL", SOL_IP, IP_TTL },
{ "IP_HDRINCL", SOL_IP, IP_HDRINCL },
{ "IP_MULTICAST_IF", SOL_IP, IP_MULTICAST_IF },
{ "IP_MULTICAST_TTL", SOL_IP, IP_MULTICAST_TTL },
{ "IP_MULTICAST_LOOP", SOL_IP, IP_MULTICAST_LOOP },
#ifdef IP_ADD_MEMBERSHIP
{ "IP_ADD_MEMBERSHIP", SOL_IP, IP_ADD_MEMBERSHIP },
{ "IP_DROP_MEMBERSHIP", SOL_IP, IP_DROP_MEMBERSHIP },
#endif
{ "TCP_MAXSEG", SOL_TCP, TCP_MAXSEG },
{ "TCP_NODELAY", SOL_TCP, TCP_NODELAY },
#ifdef SO_REUSEPORT
{ "SO_REUSEPORT", SOL_SOCKET, SO_REUSEPORT },
#endif
{ (char *)0, 0, 0 }
};
On 9-Jun-09, at 9:47 AM, Adrian Lienhard wrote:
> Hi,
>
> On the Mac VM, when starting a second image with the same VM as an
> already running image, the second image opens the same TCP ports as
> the first image.
>
> It is easy to see this. Start image A and do:
>
> s := Socket newTCP.
> s listenOn: 7777.
>
> as expected:
>
> lsof -i | grep Squeak
> Squeak 1747 adrian 9u IPv4 0x9dafa68 0t0 TCP *:cbt
> (LISTEN)
>
> Now, start image B (PID 1752).
>
> lsof -i | grep Squeak
> Squeak 1747 adrian 9u IPv4 0x9dafa68 0t0 TCP *:cbt
> (LISTEN)
> Squeak 1752 adrian 9u IPv4 0x9dafa68 0t0 TCP *:cbt
> (LISTEN)
>
> It will also listen on port 7777...
>
> Is this a known limitation?
>
> VM: 3.8.20beta1U
> Image: any (tested with Squeak 3.9 and 3.10)
>
> Cheers,
> Adrian
> ___________________
> http://www.adrian-lienhard.ch/
>
--
=
=
=
========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> Twitter:
squeaker68882
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
=
=
=
========================================================================
More information about the Vm-dev
mailing list