Re: after opening socket, sending data then closing socket 3000 times i get "Only one usage of each socket address"

From: Mike Blake-Knox (mikebkdont_at_spamintrex.net)
Date: 02/12/05


Date: Sat, 12 Feb 2005 09:53:14 EST

In article <#j3Srx9DFHA.3840@tk2msftngp13.phx.gbl>, Daniel wrote:
> i wrote a c version of this using c sockets and i did not have this issue.
> it seems that after the socket is closed it is not realy closed. i looked in
> a tcp viewer and it shows the sockets staying open for about 60 seconds
> after i close them, after 3000 it starts to error because they are all in
> use when they should disapear right after i close socket unless im missing a
> step? or is this a bug w/ TcpClient? any work around appreciated.

TCP sockets don't close instantly. When you execute a close(), the closing is
only started (but not completed) before control is returned to your code. If
you were to use the netstat command you can see the state of the sockets on
your computer.

Take a look at http://tangentsoft.net/wskfaq/articles/debugging-tcp.html for
moe details.

Mike



Relevant Pages

  • Re: Secure inter process communication through sockets
    ... Daniel ... > I think of using sockets in C#. ... (I don't want someone on the network to be able to control my ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Chunked GZIP processing using Java Sockets
    ... Sockets give me the control on handling network problems and server ... advance the stream until the input stream is past the headers? ... My java client program is reading web sites using low level sockets. ... The response from the web site HTML is chunked and gzipped. ...
    (comp.lang.java.programmer)
  • Java can do it ... why not .NET ?
    ... I have a C# control that I want to embed in IE which need to connect back to ... the host server using sockets to display a status image. ... Is there any way to make a socket connection that will work on a default ...
    (microsoft.public.dotnet.security)
  • Re: Web stuff
    ... > I thought sockets was not possible with the Plug-In? ... > We chose not to use the plug-in on a project a couple of years ago ... If you have control over that, ...
    (comp.lang.tcl)
  • Re: read()/write() versus recv()/send()
    ... > fxn@hashref.com (Xavier Noria) wrote: ... >>If you don't need that additional control, ... send/recv because read/write is *not* allowed for sockets on that OS. ...
    (comp.unix.programmer)