I'm creating a tcp socket connection from the thread in the c#
threadpool. Since the default workers thread is 500, sometimes my
program tries to open up 500 different tcp socket connections and the
connection fails after it reaches certain number of opened tcp
connection. I guess it reached the max number of tcp connection
available in the operating system. I have Professional Windows XP
2000. So what is the max simultaneous tcp connection in this
operating system? Or how can I find out the how many tcp connections
are available?
Thanks 9 24523
On Wed, 16 Jan 2008 11:16:25 -0800, Greg <gc*****@gmail. comwrote:
I'm creating a tcp socket connection from the thread in the c#
threadpool. Since the default workers thread is 500, sometimes my
program tries to open up 500 different tcp socket connections and the
connection fails after it reaches certain number of opened tcp
connection. I guess it reached the max number of tcp connection
available in the operating system. I have Professional Windows XP
2000. So what is the max simultaneous tcp connection in this
operating system? Or how can I find out the how many tcp connections
are available?
I may be wrong, but I wasn't aware of any arbitrary maximum number of
connections possible, even on a non-server version of Windows.
Your message _seems_ to be saying that you are using a thread pool thread
to create each connection. If by that you mean that each connection has
its own thread pool thread, then it seems likely to me that you're
actually running out of threads, not connections.
If you want to host a large number of multiple connections, you need to
avoid a "one thread per connection" implementation. That technique will
always unnecessarily limit the number of connections you can have at once,
and performance will suffer even before you reach that limit.
Instead, look at the asynchronous API on the Socket class (or TcpClient
and Stream if that's what you're using), where you call methods with
"Begin" and "End" as part of the names. For example,
Socket.BeginCon nect() and Socket.BeginRea d(). These methods provide a
much more scalable and efficient way of managing multiple connections with
the same parallelism that multiple threads would give you, but without the
limitations. (In fact they do use threads themselves, but in a much more
efficient way than dedicating one to each connection).
If I've misunderstood your architecture, then you should probably post a
concise-but-complete example of code that illustrates what you _are_
doing. It's too easy to misunderstand a human language description of an
implementation, but code is code. :)
Pete
Hi,
You can either be running out of TCP connections (which I do not think ) or
of threads (which I think is the cause of your problem). Try to increase the
number of threads.
--
Ignacio Machin http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Greg" <gc*****@gmail. comwrote in message
news:3b******** *************** ***********@l32 g2000hse.google groups.com...
I'm creating a tcp socket connection from the thread in the c#
threadpool. Since the default workers thread is 500, sometimes my
program tries to open up 500 different tcp socket connections and the
connection fails after it reaches certain number of opened tcp
connection. I guess it reached the max number of tcp connection
available in the operating system. I have Professional Windows XP
2000. So what is the max simultaneous tcp connection in this
operating system? Or how can I find out the how many tcp connections
are available?
Thanks
Ignacio Machin ( .NET/ C# MVP ) wrote:
You can either be running out of TCP connections (which I do not think ) or
of threads (which I think is the cause of your problem). Try to increase the
number of threads.
No, please don't follow this advice. If you're hitting the thread pool
default maximum of 500 worker threads, you're doing something wrong. That's
just not a reasonable amount of threads to use. "500" is as good as
"infinity" here, unless you have a machine with, say, 100 processors, and
memory to burn.
--
J.
Hi,
"Jeroen Mostert" <jm******@xs4al l.nlwrote in message
news:47******** *************** @news.xs4all.nl ...
Ignacio Machin ( .NET/ C# MVP ) wrote:
>You can either be running out of TCP connections (which I do not think ) or of threads (which I think is the cause of your problem). Try to increase the number of threads.
No, please don't follow this advice. If you're hitting the thread pool
default maximum of 500 worker threads, you're doing something wrong.
That's just not a reasonable amount of threads to use. "500" is as good as
"infinity" here, unless you have a machine with, say, 100 processors, and
memory to burn.
You have a point. It would be much better if the comm. are async and a
thread can handle more than one connection.
OP:
Do a search of how to do a high performance TCP server. I'm pretty sure you
will find something about how to handle 1K connections without killnig the
machine.
--
Ignacio Machin http://www.laceupsolutions.com
Mobile & warehouse Solutions.
On Wed, 16 Jan 2008 13:41:28 -0800, Ignacio Machin ( .NET/ C# MVP )
<machin TA <"laceupsolutio ns.com>"wrote:
[...]
You have a point. It would be much better if the comm. are async and a
thread can handle more than one connection.
OP:
Do a search of how to do a high performance TCP server. I'm pretty sure
you
will find something about how to handle 1K connections without killnig
the
machine.
Or, he could just read the article I posted in reply to his original
message:
<http://groups.google.c om/group/microsoft.publi c.dotnet.langua ges.csharp/browse_thread/thread/9d98656262435eb 5/c6228fc1e8ade07 8#c6228fc1e8ade 078>
I'm curious: that article has not shown up on my news server yet. I
suspect it never will. Obviously it was sent, since Google has it. Are
others not receiving it either? I could repost it, but since the main
point for doing so would be to ensure it's in the archive, and since it's
obviously already in the archive, I think there's probably no point in me
doing that.
The even shorter version of my relatively short reply is: use the
asynchronous methods on the Socket or TcpClient and Stream classes, as
appropriate. Those methods have names that all start with either "Begin"
or "End". Using that mechanism, handling a thousand connections would be
trivial; hundreds of thousands of connections should be possible, assuming
no other limitations.
Pete
On Jan 16, 11:16 am, Greg <gcad...@gmail. comwrote:
I'm creating a tcp socket connection from the thread in the c#
threadpool. Since the default workers thread is 500, sometimes my
program tries to open up 500 different tcp socket connections and the
connection fails after it reaches certain number of opened tcp
connection. I guess it reached the max number of tcp connection
available in the operating system. I have Professional Windows XP
2000. So what is the max simultaneous tcp connection in this
operating system? Or how can I find out the how many tcp connections
are available?
Thanks
I'd like to thank everyone for a quick response and for sharing their
insight.
I just stumbled across this: http://forum.emule-project.net/lofiv...hp/t56016.html
It describes that XP SP1 has an unlimited of TCP client connection
requests whereas SP2 only allows 10 per second.
I've implemented a counter that increments on the request, and
decrements when connected. If the counter should reach 10, that thread
sleeps for a maximum of 1000ms waiting for a valid connection or
timeout. Whichever comes first.
It seems to work fine now, but will be running more test to confirm
these findings. Stay tuned.
Thanks again.
Greg
The magic setting you're looking for is "MaxUserPor t". You can google this,
then make the appropiate registry change.
Thie value is typically set at 5000, and if you want lots and lots of client
connections then you need to bump the value up.
--
Chris Mullins
"Greg" <gc*****@gmail. comwrote in message
news:3b******** *************** ***********@l32 g2000hse.google groups.com...
I'm creating a tcp socket connection from the thread in the c#
threadpool. Since the default workers thread is 500, sometimes my
program tries to open up 500 different tcp socket connections and the
connection fails after it reaches certain number of opened tcp
connection. I guess it reached the max number of tcp connection
available in the operating system. I have Professional Windows XP
2000. So what is the max simultaneous tcp connection in this
operating system? Or how can I find out the how many tcp connections
are available?
Thanks
Hi Peter,
I never got it, and I have the configuration to get like 1000 messages.
I have notices the same thing with some of my posts though.
--
Ignacio Machin http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Peter Duniho" <Np*********@nn owslpianmk.comw rote in message
news:op******** *******@petes-computer.local. ..
On Wed, 16 Jan 2008 13:41:28 -0800, Ignacio Machin ( .NET/ C# MVP )
<machin TA <"laceupsolutio ns.com>"wrote:
>[...] You have a point. It would be much better if the comm. are async and a thread can handle more than one connection. OP: Do a search of how to do a high performance TCP server. I'm pretty sure you will find something about how to handle 1K connections without killnig the machine.
Or, he could just read the article I posted in reply to his original
message:
<http://groups.google.c om/group/microsoft.publi c.dotnet.langua ges.csharp/browse_thread/thread/9d98656262435eb 5/c6228fc1e8ade07 8#c6228fc1e8ade 078>
I'm curious: that article has not shown up on my news server yet. I
suspect it never will. Obviously it was sent, since Google has it. Are
others not receiving it either? I could repost it, but since the main
point for doing so would be to ensure it's in the archive, and since it's
obviously already in the archive, I think there's probably no point in me
doing that.
The even shorter version of my relatively short reply is: use the
asynchronous methods on the Socket or TcpClient and Stream classes, as
appropriate. Those methods have names that all start with either "Begin"
or "End". Using that mechanism, handling a thousand connections would be
trivial; hundreds of thousands of connections should be possible, assuming
no other limitations.
Pete
Hi Pete,
Your article showed up fine for me.
It is on the ms newsgroup server as expected.
John
"Peter Duniho" <Np*********@nn owslpianmk.comw rote in message
news:op******** *******@petes-computer.local. ..
Or, he could just read the article I posted in reply to his original
message:
<http://groups.google.c om/group/microsoft.publi c.dotnet.langua ges.csharp/browse_thread/thread/9d98656262435eb 5/c6228fc1e8ade07 8#c6228fc1e8ade 078>
I'm curious: that article has not shown up on my news server yet. I
suspect it never will. Obviously it was sent, since Google has it. Are
others not receiving it either? I could repost it, but since the main
point for doing so would be to ensure it's in the archive, and since it's
obviously already in the archive, I think there's probably no point in me
doing that.
The even shorter version of my relatively short reply is: use the
asynchronous methods on the Socket or TcpClient and Stream classes, as
appropriate. Those methods have names that all start with either "Begin"
or "End". Using that mechanism, handling a thousand connections would be
trivial; hundreds of thousands of connections should be possible, assuming
no other limitations.
Pete
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Martin Fuzzey |
last post by:
I am using xmlrpclib (based on httplib) in Python 2.3 on Mandrake
Linux.
When my client attempts to connect to a server using a
"http://localhost:port" style URL there is a long delay before the
connection is established (it finally works).
This certainly smells a name resolution problem but ping localhost,
telnet localhost etc all work...
|
by: MisterT |
last post by:
Hello,
I have a TCPclient and TCPListener created from MS sample code. They do
communicate, but the client sockets do not seem to be closed totally even
though there is a TCPclient.Close done in the client code.
I watch the network connections using "netstat -an | find "10000" ". Every
time a client socket is closed using...
|
by: Jo Davis |
last post by:
www.shanje.com
does sql server hosting, on shared servers, at a reasonable price. It seems.
They also allow client connections. Just playing around I've managed to
connect an Access Data Project to a SQL Server database, and to access the
database from Enterprise Manager (running locally).
First of all - what does anybody think of that as...
|
by: al |
last post by:
Any idea where can I get a copy of the libmysql dll with ssl enabled?
Al
|
by: Jerome Macaranas |
last post by:
Is there a way in postgres to view current client connections? including
statistics.. how long did it take for him to connect and disconnect.. etc
TIA
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
| |
by: Mark Harrison |
last post by:
We have the situation where it would be convenient if we
could support a large number (>1024, possibly in the 2000-3000
range) of client connections.
What are our options for this?
Many TIA,
Mark
--
|
by: D. Yates |
last post by:
Hi,
I'm about to embark on a project that will both send and receive information
to/from our client computers in the field.
The area that I still need to finalize is the method of communication and
|
by: shyamsunderrai |
last post by:
Dear All,
I am having the latest version of PostgreSQL i.e. 8.4.2 and in order to increase the number of client connection I have increased the parameters "max_connections" and "shared_buffers" accordingly. However, I still get the same error "too many client connections". I know that there is some relation between the kernel parameters and...
|
by: Jeff |
last post by:
Hello everyone. I've searched through the archives here, and it seems
that questions similar to this one have come up in the past, but I was
hoping that I could pick your Pythonic brains a bit.
Here's a broad overview of what I need to do: cross-platform, client-
side GUI apps that interact with a server backed by a database. I'd
also...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |