[LCP]rebind a socket

Andrew Weaver Andrew.Weaver at tecnomen.fi
Thu Nov 1 18:39:48 UTC 2001


As far I know, you cannot. Well, that is, not unless you shut it down and
re-open it. This also implies that you are specifying the port to use and
not deferring it to the stack.

I have explicitly tried to bind the same port number to > 1 interface (but
not all interfaces on the box) and this failed with EADDRINUSE. If binding
to all interfaces is OK for you, use IN_ADDR_ANY as your interface address
on the bind() and it will pick up any connect request coming to the port on
that box via any interface.

Ooops! above refers to TCP but IN_ADDR_ANY applies to UDP as well, just not
the connect...

> -----Original Message-----
> From:	Karel Cardona [SMTP:kcardona at marsys.com]
> Sent:	Wednesday, October 31, 2001 6:48 PM
> To:	Linux C Programming
> Subject:	[LCP]rebind a socket
> 
> 
> Hi 
> 
> Does any one know how to rebind a socket to a new address?
> 
> Best Regards,
> 
> Karel Cardona
> Software Engineer
> MSI-Miami 
> www.marsys.com
> www.Metilinx.com
> 
> 
> _______________________________________________
> This is the Linux C Programming List
> :  http://lists.linux.org.au/listinfo/linuxcprogramming List



More information about the linuxCprogramming mailing list