TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sharon
NA
20
13.3k
Socket hanging on CLOSE_WAIT
Sep 27 2010 9:36 AM
Hi Gurus,
I have a C# project on VS2008, Framework 3.5.
I'm using a TCP socket like that:
Socket mClientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
mClientSocket.NoDelay = true;
mClientSocket.Blocking = true;
mClientSocket.DontFragment = false;
mClientSocket.LingerState.Enabled = false;
mClientSocket.LingerState.LingerTime = 0;
mClientSocket.UseOnlyOverlappedIO = true;
// Get the remote IP address.
System.Net.IPAddress[] IPs = System.Net.Dns.GetHostAddresses(ExchangeIPAddress); // ExchangeIPAddress is a string with the IP address
IPAddress ip = IPs[0];
int iPortNo = System.Convert.ToInt32(ExchangePort);// ExchangePort is string with the port
// Create the end point.
IPEndPoint ipEnd = new IPEndPoint(ip, iPortNo);
// Connect to the remote host.
mClientSocket.Connect(ipEnd);
I have some cases that the socket is hanging on CLOSE_WAIT (shown on the Process Explorer), and stay like that forever, causing the data flow to cease.
There is no error return value anywhere, and no exception is thrown.
Therefore; I have no idea to what can cause this. Only closing the client application and starting it again, solve the problem. I this client restart is not acceptable solution.
Can anyone aid me to find what might cause this CLOSE_WAIT to hang like that?
--
Thanks
Sharon
Reply
Answers (
2
)
Why C# Doesnt Support Multiple Inheritance ?
Renumbering positions in hierarchy,