Re: Question about sockets

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

 



Hi Leonardo,

The gcc-help forum is not the correct forum for socket and pthread
questions.  I do not say this to chastise you, rather to inform you that
faster, more accurate help is likely to come from a more appropriate forum.

That being said...

Your source code is too long.  Could you trim it down to a much smaller
example that exhibits the problem?

Also, when you close your socket, it does not appear that you first did a
shutdown of the socket.

man 2 close
man 2 shutdown

You may want to adjust your socket options, such as linger or timeout.

man 2 setsockopt

The CLOSE_WAIT means the remote connection has finished sending data, and
your side has not yet done a shutdown and close.

The TIME_WAIT means that both sides have close'd the connection, but the IP
stack is obliged to wait a prescribed time before taking the connection
down.  This is normal, and expected.

Also, your communication may be affected by Nagle's algorithm.  In most
cases, Nagle's algorithm is a good thing.  For certain kinds of IP
communication (what I'd call "chatty" communication), it can introduce
undesirable latency.

Sincerely,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux