2010-02-26 17:45:48     socket not closed completely

Document created by Aaronwu Employee on Aug 20, 2013
Version 1Show Document
  • View in full screen mode

2010-02-26 17:45:48     socket not closed completely

Hans Waldmann (UNITED STATES)

Message: 86615   

 

Hi PTG

 

We are seeing a problem with closing a UDP socket and then trying to open a new socket which binds to the same port and IP address. We are using 2008r1 version.

 

We start by having a UDP socket which we bind to a specific port and our local IP address. Then we use the close() function to shut it down. Then we open a new socket and try to bind to that same port and local IP address.

 

In some cases the bind fails with errno=98 meaning that the address is still in use.

 

We are not sure why this is happening with a UDP type socket. We know this can happen with a TCP type socket and in this case use the address reuse option on the socket.

 

Do you have any idea on why this is happening or what can be done about it?

 

Hans

QuoteReplyEditDelete

 

 

2010-02-28 16:02:33     Re: socket not closed completely

Mike Frysinger (UNITED STATES)

Message: 86645   

 

use `netstat -na` to find out what state the socket is in exactly

QuoteReplyEditDelete

 

 

2010-03-03 10:41:15     Re: socket not closed completely

Hans Waldmann (UNITED STATES)

Message: 86760   

 

Here is what I got:

 

 

 

netstat -an

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address           Foreign Address         State

tcp        0      0 192.168.1.103:5060      0.0.0.0:*               LISTEN

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN

tcp        0      0 0.0.0.0:23              0.0.0.0:*               LISTEN

tcp        0      0 0.0.0.0:7548            0.0.0.0:*               LISTEN

tcp        0      1 192.168.1.103:45308     10.121.26.209:8080      SYN_SENT

udp        0      0 192.168.1.103:5060      0.0.0.0:*

Active UNIX domain sockets (servers and established)

Proto RefCnt Flags       Type       State         I-Node Path

unix  4      [ ]         DGRAM                    2326   /dev/log

unix  2      [ ]         DGRAM                    2341

unix  2      [ ]         DGRAM                    2329

 

We are trying to bind on the 5060 udp socket.

Attachments

    Outcomes