leonidlm has asked for the wisdom of the Perl Monks concerning the following question:
My question is very simple: What the following line does? ioctl($MySocket, 0x8004667e, pack("I", 1)); Whotout this line the timeout just won't work, it freezes on $MySocket->recv($text,128); I just found it and paste it in my code and now it is working! I really want to fully understand that. Thanks all!sub sampleNode { my ($msg, $peerAddr, $eTime) = @_; my $bol = 0; print "Sending the message to the server for node $msg...\n"; $MySocket = new IO::Socket::INET->new( PeerPort => 6060, Proto => 'udp', PeerAddr => $peerAddr, ); ioctl($MySocket, 0x8004667e, pack("I", 1)); $MySocket->send($msg); while((time() < $eTime) && (!$bol)) { #print "time: " . time() . ", threshold: $eTime\n"; $MySocket->recv($text,128); print $text; if($text =~ /OK/) { print "Received ok response: $text"; $bol = 1; } } return $bol; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: UDP socket connect.
by glide (Pilgrim) on Jan 31, 2008 at 11:28 UTC | |
by leonidlm (Pilgrim) on Jan 31, 2008 at 11:49 UTC | |
by glide (Pilgrim) on Jan 31, 2008 at 14:29 UTC | |
by leonidlm (Pilgrim) on Jan 31, 2008 at 14:56 UTC | |
|
Re: UDP socket connect.
by glide (Pilgrim) on Jan 31, 2008 at 11:12 UTC |