Hi,
I have an urgent problem need help. We have an Asp.net application runing on window 2003 server. One part of the application is socket programming. When customer hits our site a little bit heavier, after serveral thoudsands hits, I statrt to get a bunch of
An existing connection was forcibly closed by the remote host
exceptions, then if the customer continue hits the site, the other function throw out of memory exception, The result is our site not responding any more. The attached is the socket call programming, any help will be appreciated! Thank you.
IPAddress[] ips = Dns.GetHostAddresses(m_sAVSHost); IPEndPoint oIPEndPoint = new IPEndPoint(ips[0], iAvsPort); Socket oSocket = new Socket(oIPEndPoint.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp); try { oSocket.Connect(oIPEndPoint); byte[] bSendBytes = Encoding.UTF8.GetBytes(sAvsParam); oSocket.Send(bSendBytes, bSendBytes.Length, SocketFlags.None);
byte[] bRecvBytes = new byte[4096]; oSocket.Receive(bRecvBytes, SocketFlags.None); rtnVal = Encoding.UTF8.GetString(bRecvBytes).Trim(); } catch (Exception ex) { VVXmlListenerException.LogException(new VVXmlListenerException(ex)); } finally { oSocket.Shutdown(SocketShutdown.Both); oSocket.Close(); }
.NET Development25
|