Re: 10048 (not 10038!)

Giganews Newsgroups
Subject: Re: 10048 (not 10038!)
Posted by:  Remy Lebeau (TeamB) (
Date: Mon, 23 May 2005

"Vlad Gonchar" <vgonch…> wrote in message

> If I loop this call 1000 times (payload = 1K) in two clients
> simultaneously. I get 10048 error.


    Address already in use.

    Only one usage of each socket address (protocol/IP address/port) is
normally permitted. This error occurs if an application attempts to bind a
socket to an IP address/port that has already been used for an existing
socket, or a socket that wasn't closed properly, or one that is still in the
process of closing. For server applications that need to bind multiple
sockets to the same port number, consider using setsockopt (SO_REUSEADDR).
Client applications usually need not call bind at all - connect will choose
an unused port automatically.

In other words, the sockets are not being closed fully, and when you then
make a new socket connection, an IP/port combo for a previous socket is
trying to be reused for the new socket.

My guess would be that you are looping the requests too fast.  There is a
time delay involved before a socket becomes fully closed after the software
closes the socket programmably.  This delay can be length (2 minutes by




In response to

10048 (not 10038!) posted by Vlad Gonchar on Mon, 23 May 2005