TCP IP server - "Address already in use"

Hi all,

I’m getting this - “Adress already in use.” error every now and then after
stopping and restarting a TCP IP server program.

We have a Windows Visual Basic client running on the other end.
When I stop the client first, then my QNX server; and then start the server
again, this is the error I get. Just waiting for around 30 sec before
starting the server works fine.
The server is just a simple process allowing for one client at a time to
connect to a specific port.
The server closes – close () function – the connection in either case
(stopping while client is running or not).
I’m using a Watcom compiler.

Any help would be appreciated.

Thanks,

Peter.

“Peter Lanc” <peter.lanc@echidna.com.au> wrote in message
news:9b1447$jfl$1@inn.qnx.com

Hi all,

I’m getting this - “Adress already in use.” error every now and then after
stopping and restarting a TCP IP server program.

We have a Windows Visual Basic client running on the other end.
When I stop the client first, then my QNX server; and then start the
server
again, this is the error I get. Just waiting for around 30 sec before
starting the server works fine.
The server is just a simple process allowing for one client at a time to
connect to a specific port.
The server closes – close () function – the connection in either case
(stopping while client is running or not).
I’m using a Watcom compiler.

I would bet your client doesn’t close the socket when it exits.

As far as I know there is nothing you can do about this.

Any help would be appreciated.

Thanks,

Peter.
\

The OS will not give out the same port number again for a certain time, to make
sure that any stray packets on the network that were intented for the first
instance don’t end up getting delievered to the second instance. This is the
TIME_WAIT state (search the RFC’s for detailed discussions).

If you don’t like having your bind fail with and “Address already in use”, you
could try playing with the REUSE_PORT or REUSE_ADDR socket options.

Stan

Mario Charest wrote:

“Peter Lanc” <> peter.lanc@echidna.com.au> > wrote in message
news:9b1447$jfl$> 1@inn.qnx.com> …
Hi all,

I’m getting this - “Adress already in use.” error every now and then after
stopping and restarting a TCP IP server program.

We have a Windows Visual Basic client running on the other end.
When I stop the client first, then my QNX server; and then start the
server
again, this is the error I get. Just waiting for around 30 sec before
starting the server works fine.
The server is just a simple process allowing for one client at a time to
connect to a specific port.
The server closes – close () function – the connection in either case
(stopping while client is running or not).
I’m using a Watcom compiler.


I would bet your client doesn’t close the socket when it exits.

As far as I know there is nothing you can do about this.

Any help would be appreciated.

Thanks,

Peter.
\

The OS will not give out the same port number again for a certain time, to make
sure that any stray packets on the network that were intented for the first
instance don’t end up getting delievered to the second instance. This is the
TIME_WAIT state (search the RFC’s for detailed discussions).

If you don’t like having your bind fail with and “Address already in use”, you
could try playing with the REUSE_PORT or REUSE_ADDR socket options.

Stan

Mario Charest wrote:

“Peter Lanc” <> peter.lanc@echidna.com.au> > wrote in message
news:9b1447$jfl$> 1@inn.qnx.com> …
Hi all,

I’m getting this - “Adress already in use.” error every now and then after
stopping and restarting a TCP IP server program.

We have a Windows Visual Basic client running on the other end.
When I stop the client first, then my QNX server; and then start the
server
again, this is the error I get. Just waiting for around 30 sec before
starting the server works fine.
The server is just a simple process allowing for one client at a time to
connect to a specific port.
The server closes – close () function – the connection in either case
(stopping while client is running or not).
I’m using a Watcom compiler.


I would bet your client doesn’t close the socket when it exits.

As far as I know there is nothing you can do about this.

Any help would be appreciated.

Thanks,

Peter.
\

The OS will not give out the same port number again for a certain time, to make
sure that any stray packets on the network that were intented for the first
instance don’t end up getting delievered to the second instance. This is the
TIME_WAIT state (search the RFC’s for detailed discussions).

If you don’t like having your bind fail with and “Address already in use”, you
could try playing with the REUSE_PORT or REUSE_ADDR socket options.

Stan

Mario Charest wrote:

“Peter Lanc” <> peter.lanc@echidna.com.au> > wrote in message
news:9b1447$jfl$> 1@inn.qnx.com> …
Hi all,

I’m getting this - “Adress already in use.” error every now and then after
stopping and restarting a TCP IP server program.

We have a Windows Visual Basic client running on the other end.
When I stop the client first, then my QNX server; and then start the
server
again, this is the error I get. Just waiting for around 30 sec before
starting the server works fine.
The server is just a simple process allowing for one client at a time to
connect to a specific port.
The server closes – close () function – the connection in either case
(stopping while client is running or not).
I’m using a Watcom compiler.


I would bet your client doesn’t close the socket when it exits.

As far as I know there is nothing you can do about this.

Any help would be appreciated.

Thanks,

Peter.
\