UDP Broadcast Receive

G

Guest

I'm going around in circles here and need some help.

Scenario: I am using (have used) either the UDPClient class or Sockets
class to broadcast some bytes to 255.255.255.255 (udp protocol). Upon doing
so, a device (of which I will know nothing about) will receive my broadcast
and send out a broadcast of its own. Using Ethereal (LAN packet sniffer), I
can see my broadcast, and I can see the device broadcast. I cannot however
receive the broadcast with my VB.NET code.

I have tried the same Socket object for the send and receive, and I have
tried different Socket objects for the send and receive. The send always
works great, but the receive just sits there like a bump on a log.

Does anyone have a code example for RECEIVING A BROADCAST MESSAGE.

Thanks!
 
M

m.posseth

well i just recently had to make a client server discoverer

i found some code here and some code there put it all together in a nice
broadcast and receiver class

it works flawless and is verry simple code ( easy to understand )

if you are interested i can send them to you ,,,, as i do not believe that i
can post binary`s in this newsgroup

regards

Michel; Posseth [MCP]
 
G

Guest

Well guys. No luck yet. Here may be some more useful info. The device
broadcasts its response back on the same port number that the initial
broadcast on my PC was sent from. Therefore, I MUST be listening on the port
that I sent from.

I cannot change the device broadcast port number, as this is a 3rd party
device that I have no access to. The code examples work great for listening
to the original broadcast on some port number, but don't work when the send
port and listen port need to be the same.
 
G

Guest

I should have tried my last test before sending my previous response. I got
side tracked while investigating the Socket option ReuseAddress. Setting
this option to true on my Sender Socket allows me to have my Send and Receive
objects using the same port. Program works like a champ now.

Thank you guys for the responses.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top