Re: Maximum sockets
From: Michael K. O'Neill (mikeathon2000_at_nospam.hotmail.com)
Date: 02/10/05
- Next message: RD: "RE: avoid dns scavenging"
- Previous message: Ritesh: "Query about connecting to a proxy server that requires authorisati"
- In reply to: Phil Frisbie, Jr.: "Re: Maximum sockets"
- Next in thread: Phil Frisbie, Jr.: "Re: Maximum sockets"
- Reply: Phil Frisbie, Jr.: "Re: Maximum sockets"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 10 Feb 2005 09:14:33 -0800
"Phil Frisbie, Jr." <phil@hawksoft.com> wrote in message
news:eslE5FwDFHA.3368@TK2MSFTNGP10.phx.gbl...
> <snip>
> Yes, you found your problem, even if you did not understand that answer!
When
> you call connect() Windows assigns it to a unused port. The problem is
that by
> default Windows only uses the ports from 1024 through 5000. When you close
a TCP
> socket, it stays in the CLOSE_WAIT for about two minutes, so you can only
> connect and close less than 3976 sockets every two minutes.
>
> --
> Phil Frisbie, Jr.
> Hawk Software
> http://www.hawksoft.com
>
I thought the WSAEADDRINUSE error occurred only when a connection was
attempted on the same four-tuple (i.e., on the exact same IP and port for
both the client and server). If that's correct, then it's not entirely
accurate to say "you can only connect and close less than 3976 sockets every
two minutes." It would be more accurate to say "you can only connect and
close less than 3976 sockets every two minutes between the same two
machines".
This MSDN KB article talks about the issue, although in the context of a
very specific problem: "PRB: "WSAEADDRESSINUSE" Error Message When You Try
to Connect Through an Anonymous Port After You Increase the IMAP Connection
Limit" at http://support.microsoft.com/default.aspx?scid=kb;en-us;319502 .
I had seen this article before, but it was hard to find it again since
someone had misspelled WSAEADDRINUSE (it's not "WSAEADDRESSINUSE" as spelled
in the article).
Incidentally, I think that "ephemeral port" is often called "anonymous port"
in Winsock-world.
In any event, in a nutshell, could you explain how your library overcomes
the "1024 to 5000" port range limitation without a registry edit? Do you
close the socket with SO_REUSEADDR, or maybe assign port numbers yourself?
Mike
- Next message: RD: "RE: avoid dns scavenging"
- Previous message: Ritesh: "Query about connecting to a proxy server that requires authorisati"
- In reply to: Phil Frisbie, Jr.: "Re: Maximum sockets"
- Next in thread: Phil Frisbie, Jr.: "Re: Maximum sockets"
- Reply: Phil Frisbie, Jr.: "Re: Maximum sockets"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|