client server network problem
-
Hi, I write a client server network program, the client part using HttpWebRequest to access the server. The server part uses threading and sockets list to listen the client request. The program worked fine in .NET1.0 and after I upgraded to VS2005 (NET2.0) the program didn't work, with the error in client side as "unable to write data to the transport connection, connection closed by program in host". The strange part is that the error come out in the second access from the client to the server. The first access to server is OK, but the second access can't connect to the server and generated the error. I suspect that this may be due to NET2.0 upgrade, but don't know the exact problem. Anyone can help ? Part of the client code is as below, try { WebRequest request = HttpWebRequest.Create(remoteClientSession.URL); string contentType = "multipart/form-data;"; request.ContentLength = message.Length; request.Method = "POST"; request.Timeout = timeoutTime; Stream requestStream = request.GetRequestStream(); requestStream.Write(message, 0, message.Length); ** error start to throw here requestStream.Close(); } catch (WebException webEx) { } catch (IOException ex) { ** the error throw in here "Unable to write data to the transport connection" } WebResponse response = request.GetResponse(); ..... Thanks