Hi,
here is my trouble.I writed a server on some port on one
redhat 6.1 to receive a 400k file then save it in local
disk.
always,once had read 13824 bytes from the socket,the job
stopped,no error report.looks like it was suspended forever.
nothing more can be read from the read buffer.
I got several SOL_SOCKET level values:
SO_RCVBUF 65535
SO_SNDBUF 65535
SO_RCVLOWAT 1
SO_SNDLOWAT 1
SO_RCVTIMEO 0
SO_SNDTIMEO 0

my codes below
########################server.pl #!/usr/bin/perl $args=@ARGV; if($args!=2) { print "usage:server.pl [localport] [localfile]\n"; exit; } $port=$ARGV[0]; $file=$ARGV[1]; use IO::Socket; $skt=IO::Socket::INET->new(LocalAddr=>'0.0.0.0',LocalPort=>$port,Proto +=>'tcp',Listen=>5)||do{ print $!."\n"; exit; }; $skt->autoflush(1); print "Ready on port $port ...\n"; $newskt=$skt->accept; $newskt->sockopt(SO_SNDLOWAT,2048); $newskt->autoflush(1); print "client is coming ...\n"; open (FILE,">$file")||die $!; while($n=sysread($newskt,$buf,2)) { $total+=$n; print FILE $buf; print "received:".$total."\r"; } close FILE; $newskt->close(); $skt->close(); print "\nDone.($file)\n"; ########################client.pl #!/usr/bin/perl $args=@ARGV; if($args!=3) { print "usage:client.pl [peerhost] [peerport] [localfile]\n"; exit; } $host=$ARGV[0]; $port=$ARGV[1]; $file=$ARGV[2]; use IO::Socket; $skt=IO::Socket::INET->new(PeerAddr=>$host,PeerPort=>$port,Proto=>'tcp +')||do{ print $!."\n"; exit; }; print "Begin ...\n"; open (FILE,"$file")||die $!; binmode FILE; while($n=read(FILE,$buf,512)) { $total+=$n; print $skt $buf; print "sent:".$total."\r"; } close FILE; $skt->close(); print "\nDone.(local $file to remote $host)\n";

server.pl output:
Ready on port 8888 ...
client is coming ...
received:13824
ok,wait forever here!
What is possible reason of that?kernel restriction?
Thanks for any help in advance.

In reply to network suspend again! by iic

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.