Perl Monk, Perl Meditation PerlMonks

### Comment on

 Need Help??
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:

  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(""); [download] And use this to get the answer: $FindCard->recv($datagram,120,$flags);
[download]

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

In reply to Answer to a UDP Broadcast is ignored by Anonymous Monk

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, 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, 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: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?
• See Writeup Formatting Tips and other pages linked from there for more info.

Create A New User
Chatterbox?
 [Corion]: thezip: start "some title" path\to\that\ application, but that will open another console window [Corion]: thezip: If you want to confuse your users, use system(1, "that\\command" );, which will make Perl launch it in the background [Corion]: That will keep the console window open even though the user can't type into it anymore [thezip]: So I have a script that generates a log file. After script completion, I want tohave VIM open this logfile. [thezip]: i don't get the command line "back" until I close VIM. No what I want to happen... [thezip]: I currently don't have access to CYGWIN, else I'd just do a tail -f on the logfile.

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2017-03-27 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
Should Pluto Get Its Planethood Back?

Results (321 votes). Check out past polls.