in reply to UDP Broadcasts

If you bind your socket before the broadcast to a portnumber (nothing fancy there, just any ordinary 1234 number) I think you will get your response there, which means a recv will do.

Replies are listed 'Best First'.
Re: Re: UDP Broadcasts
by jamesdmorris (Sexton) on May 02, 2002 at 17:20 UTC
    here is my current source:
    #!/opt/perl-5.004/bin/perl use IO::Socket; my $pipeline_string= "\x00\x00\x07\xa2\x08\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x +00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0 +0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 +\x00\x00\x00\x00\x00\x00"; $bufsize = 1024; my $myip="204.4.143.170"; $sock = new IO::Socket::INET(PeerAddr => "255.255.255.255", PeerPort => "9", Proto => "udp", LocalAddr => $myip, LocalPort => "9999" ); $sock->send($pipeline_string); $sock->recv($buf, $bufsize); print $buf;
      I think there is a bug(let) in IO::Socket::INET. Local* is ignored if there is a PeerAddr. Annoyingly you will need it in your code. Otherwise your code should be good. Are you sure that the answer is printable and is not cut short at the first \x00?