开发者

TCP connection lost problems in c#

In my application, I have a server listening on a port on localhost for client connection. Then I have clients running and establishes connection with the server. I used tcpListner in c# for the server and the clients were written in perl using Inet function.

The connection between clients and server were established without a problem and a message from client is received by the server. However, after about 3 to 4 seconds, the connection is lost. I use netstat -a to see if the status of the connection is still "established". The result is "Close_wait" after I use netstat command on DOS.

How can I debug this problem? Which side is causing the lost of connection?

Thanks

Edit:

$tx_socket = IO::Socket::INET->new( PeerAddr => '127.0.0.1', PeerPort => 9000, 
    LocalPort => 8000, Proto => 'tcp', 
    Type =>SOCK_STREAM, Reuse=>1 ) or die("$!\n"); 
die("init_tx_socket failed!\n") unless $tx_socket; print "Soc开发者_StackOverflowket good!\n"; 
$tx_socket->autoflush(1); $tx_socket->print("Hello"); 
sleep(5); 
$tx_socket->print("World");


Capturing network packets with Microsoft Network Monitor or Wireshark, or use System.Net tracing.

Socket issues cannot be easily analyzed and handled without such analysis.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜