[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: IPv6 socket programming



On Wed, May 23, 2001 at 05:16:43PM +0300, Tommi Komulainen wrote:
> Since this was meant as an example, I guess you want to use the following
> instead of plain bind(skt):
>     bind(skt, res->ai_addr, res->ai_addrlen)
Sorry, I should of used bind(skt...)

> OTOH, in linux, if you bind an IPv6 socket to a port, you can't bind an
> IPv4 socket to the same port anymore, the call will fail with 'Address
> already in use'.  Instead, the IPv6 socket would get all IPv4 packets as
> well.  Basically you should just break out of the loop after the listen,
> assuming all the preceding calls succeeded.
Ah hence the "great bind doesn't work right" email debate last month.
(it wasn't a flame, it was very constructive).

Am I guaranteed that the first item in the res linked list will be
the IPv6 address?  If the list is random, then I'll randomly bind to a
IPv4 or IPv6 address depending on how the library feels.


> Someone correct me if I'm wrong, but I think this different behaviour of
> bind() is the current showstopper for writing portable IPv6 applications.
It seems that way. That's unfortunate.

  - Craig
-- 
Craig Small VK2XLZ  GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
Eye-Net Consulting http://www.eye-net.com.au/        <csmall@eye-net.com.au>
MIEEE <csmall@ieee.org>                 Debian developer <csmall@debian.org>



Reply to: