Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi there,
i'm pretty new to Perl (in fact i started to learn last Friday...), so please forgive me.
There is a server in my local net (in fact it's a SD Card with a WiFi and webserver where you can download the pics the Camera just stored on the Card).
First of all my programm has to find the card on the network. That should be done by sending a UDP Broadcast from a specific to a specific port. The card Answers with a unicast to my PC telling it's IP Addr.
I'm using the following to send the Broadcast:
Running Wireshark i see the Broadcast beeing send, and also the unicastanswer from the server. But my programm happily ignores this answer.
If i change the PeerAddr to the actual IP Address of the server and send the UDP datagram via unicast i get the same answer from the server, but my Programm is able the cope with it.
All i can think of is that in broadcast the PeerAddress i'm sending to and the address answering is different, so it is ignored.
I've tried searching the web for the whole weekend, but all i found where people having similar problems. But none could tell them what to do. So does anybody have a idea what i could search for?
Thanks,
Sven
i'm pretty new to Perl (in fact i started to learn last Friday...), so please forgive me.
There is a server in my local net (in fact it's a SD Card with a WiFi and webserver where you can download the pics the Camera just stored on the Card).
First of all my programm has to find the card on the network. That should be done by sending a UDP Broadcast from a specific to a specific port. The card Answers with a unicast to my PC telling it's IP Addr.
I'm using the following to send the Broadcast:
And use this to get the answer:my $FindCard = IO::Socket::INET->new(Proto=>"udp",LocalPort=>58255,P +eerPort=>55777,PeerAddr=>"192.168.11.255",Broadcast=>1) or die "Can't make UDP socket: $@"; $FindCard->send("");
$FindCard->recv($datagram,120,$flags);
Running Wireshark i see the Broadcast beeing send, and also the unicastanswer from the server. But my programm happily ignores this answer.
If i change the PeerAddr to the actual IP Address of the server and send the UDP datagram via unicast i get the same answer from the server, but my Programm is able the cope with it.
All i can think of is that in broadcast the PeerAddress i'm sending to and the address answering is different, so it is ignored.
I've tried searching the web for the whole weekend, but all i found where people having similar problems. But none could tell them what to do. So does anybody have a idea what i could search for?
Thanks,
Sven
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Answer to a UDP Broadcast is ignored
by VinsWorldcom (Prior) on Apr 29, 2013 at 11:51 UTC | |
by Anonymous Monk on Apr 30, 2013 at 07:17 UTC |
Back to
Seekers of Perl Wisdom