Hello,
I've written a server that acts as a proxy between the PC and the mainframe
worlds. This server service is writting in C# w/.NET 1.1. The service is
TCP/IP based and makes heavy use of sockets.
The "client" to the service is a C# class library that also uses sockets.
I've managed to get the performance of the service up to a decent speed but
I've hit a strange problem.
My test program (that uses the C# class library) runs a series of
transactions on multiple threads for a configurable number of iterations.
Everything runs fine up until around 3600-3900 transactions (total) at which
point my C# class library throws a SocketException from the Socket.Connect
call:
System.Net.Sock ets.SocketExcep tion: Only one usage of each socket address
(protocol/network address/port) is normally permitted.
I understand what this message is saying but I don't know why I'm getting
it. The C# class library guarantees, in its Dispose() method that
Socket.Close() is called (to free the underlying socket handle.) The test
program wraps the C# class in a "using" block to ensure the Dispose() method
is called on my C# class (which inherits from IDisposable.) I even tried
setting the DontLinger option to true but the problem remains. Doing a
"NETSTAT -a" in the console shows numerous TCP/IP connections from the test
program to the service with a TIME_WAIT status; so, apparently all the
sockets are being consumed and not released fast enough.
If I terminate the process (or even wait a while) I can run another 3600
transactions before getting this error. The problem with this is that I can
reach 3600 transactions in about 1 minute.
Is what I'm seeing a bug in System.dll library? Peeking into the source
shows that the Socket class calls OSSOCK.closesoc ket in its Dispose()
method, so I'm not sure why things aren't getting closed. Eventually the
socket handles are freed but it seems to take just long enough to cause
issues.
Is there a socket option that I can set to alleviate this issue? Can
Windows just not keep up with freeing the socket handles?
Any help would be greatly appreciated.
Thank you in advance,
Joel 1 4853
Bah sorry, wrong forum, well unless someone knows. :)
"J. Dudgeon" <j-*************** ***@ca.unisys.c om> wrote in message
news:O6******** ******@TK2MSFTN GP10.phx.gbl... Hello,
I've written a server that acts as a proxy between the PC and the
mainframe worlds. This server service is writting in C# w/.NET 1.1. The service is TCP/IP based and makes heavy use of sockets.
The "client" to the service is a C# class library that also uses sockets. I've managed to get the performance of the service up to a decent speed
but I've hit a strange problem.
My test program (that uses the C# class library) runs a series of transactions on multiple threads for a configurable number of iterations. Everything runs fine up until around 3600-3900 transactions (total) at
which point my C# class library throws a SocketException from the Socket.Connect call:
System.Net.Sock ets.SocketExcep tion: Only one usage of each socket address (protocol/network address/port) is normally permitted.
I understand what this message is saying but I don't know why I'm getting it. The C# class library guarantees, in its Dispose() method that Socket.Close() is called (to free the underlying socket handle.) The test program wraps the C# class in a "using" block to ensure the Dispose()
method is called on my C# class (which inherits from IDisposable.) I even tried setting the DontLinger option to true but the problem remains. Doing a "NETSTAT -a" in the console shows numerous TCP/IP connections from the
test program to the service with a TIME_WAIT status; so, apparently all the sockets are being consumed and not released fast enough.
If I terminate the process (or even wait a while) I can run another 3600 transactions before getting this error. The problem with this is that I
can reach 3600 transactions in about 1 minute.
Is what I'm seeing a bug in System.dll library? Peeking into the source shows that the Socket class calls OSSOCK.closesoc ket in its Dispose() method, so I'm not sure why things aren't getting closed. Eventually the socket handles are freed but it seems to take just long enough to cause issues.
Is there a socket option that I can set to alleviate this issue? Can Windows just not keep up with freeing the socket handles?
Any help would be greatly appreciated.
Thank you in advance,
Joel
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: J. Dudgeon |
last post by:
Hello,
I've written a server that acts as a proxy between the PC and the mainframe
worlds. This server service is writting in C# w/.NET 1.1. The service is
TCP/IP based and makes heavy use of sockets.
The "client" to the service is a C# class library that also uses sockets.
I've managed to get the performance of the service up to a...
|
by: Jimbo |
last post by:
Hi Guys,
I'm sorry if you have heard this one before but searching the net
hasn't found a solution.
I am using Socket in a client to connect to a server. However, after
I've finished sending and recieving data and call the Close() method the
socket lingers for a couple of minutes. This is demonstrated by using
netstat -a.
I've tried an...
|
by: coloradowebdev |
last post by:
i am working on basically a proxy server that handles requests via remoting
from clients and executes transactions against a third-party server via TCP.
the remoting site works like a champ. my problem is executing the
transactions against the remote server and returning the response to the
remoting client. i can open the socket fine and,...
|
by: Stuart |
last post by:
I am trying to execute a Socket.Select() statement on an arraylist of
sockets. The problem is that I can only go up to 64 sockets at a time. I
know that I have to manipulate the FD_SetSize to increase the limit. How
do you do that in C# in the .NET Visual Studio environment?
I could potentially have 1000's of simultaneous connections, so...
|
by: Sharon |
last post by:
Hi all.
I'm trying first time async socket connection.
In all the examples i've seen, the server connection is closed
when the message is complete.
Is it common to close the connection after every message?
Also, the message is complete, meaning there is no more data to read, only
when the client closes the connection.
My solution is to keep...
| |
by: Macca |
last post by:
My app has an asynchronous socket server. It will have 20 clients connected
to the server. Each client sends data every 500 millisecondsThe Connections
once established will not be closed unless there is a problem with the
connection.
I need to know which client has sent the incoming data as each client has
its own buffer on my "server"...
|
by: Macca |
last post by:
Hi,
I am writing an asychronous socket server to handle 20+ simulataneous
connections.
I have used the example in MSDN as a base. The code is shown at end of
question.
Each connection has a number of different types of data coming in. I have a
databuffer for each type of data coming in.
|
by: atlaste |
last post by:
Hi,
In an attempt to create a full-blown webcrawler I've found myself
writing a wrapper around the Socket class in an attempt to make it
completely async, supporting timeouts and some scheduling mechanisms.
I use a non-blocking approach for this, using the call to 'poll' to
support the async mechanism - rather than the 'begin' and 'end'...
|
by: A. W. Dunstan |
last post by:
I'm creating a socket as follows:
m_networkSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
m_networkSocket.LingerState = new LingerOption(true, 1);
m_networkSocket.Blocking = true;
m_networkSocket.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.NoDelay, true);...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: 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...
| |