Re: Sockets and the RI

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

 



Robert Schuster a écrit :
Hi,
I still have trouble with the Sockets ....

First I found out that certain Sockets which do not succeed in establishing a
connection (a wanted scenario in the mauve test) do not get properly closed. I
took some time until I found the simple answer: These sockets do their connect()
attempt inside the constructor. When connect() throws an exception the caller
will not get an instance on which it can call close(). I therefore added some
exception handling code and thought: "Yeah, now those spurious BindExceptions in
every quick second test run will be fixed."

However this is not the case. :(

A little googling about 'unbinding' a socket revealed that this is achieved by
closing it (fine I thought). However it also tells that a closed socket remains
busy for 60 seconds on most systems. Ok this looks exactly like the problem I faced.

But WTF? Running the tests quickly after on the RI does not cause those
BindExceptions? What is this? Magic?

I felt lost and so put out strace to see what the RI is doing with my operating
system. I saw no special system calls and to my surprise not a single failing
bind() call.

However there is one very odd thing which I dont understand: new
Socket("127.0.0.1", 10008) will do bind call with AF_INET6 and :: as the address
on the RI.

Could this have anything to do with the bind problems I am seeing?
If not, what could I do trick the 60 second timeout?
Wikipedia tells 127.0.0.1 is ::1 in IPv6. What is :: then?

I hope one can enlighten me. :)

Regards
Robert
Hello Robert,

In IPv6, :: is a shortcut to avoid writing long series of 0. Here it means 0:0:0:0:0:0:0:1, which is the loopback address in ipv6, as you said.

Regards,

yohann


[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux