Problems with UDP Broadcast

  • Thread starter Thread starter Jerry Spence1
  • Start date Start date
J

Jerry Spence1

I have the following piece of code:

Dim udpClient As New UdpClient
Dim MyData = "1234567890ABC"
udpClient.Connect("255.255.255.255", 999)
Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(MyData)
udpClient.Send(sendBytes, sendBytes.Length)


The puzzle is that MyData has to be greater than 13 bytes to work. Any less
and it simply doesn't send out a packet (I have a network analyser to check
this).

I've also tried the following with no effect.

udpClient.EnableBroadcast = True
udpClient.DontFragment = True
udpClient.MulticastLoopback = False


This has me baffled. Any ideas?

-Jerry
 
Jerry Spence1 said:
I have the following piece of code:

Dim udpClient As New UdpClient
Dim MyData = "1234567890ABC"
udpClient.Connect("255.255.255.255", 999)
Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(MyData)
udpClient.Send(sendBytes, sendBytes.Length)


The puzzle is that MyData has to be greater than 13 bytes to work. Any
less and it simply doesn't send out a packet (I have a network analyser to
check this).

I've also tried the following with no effect.

udpClient.EnableBroadcast = True
udpClient.DontFragment = True
udpClient.MulticastLoopback = False


This has me baffled. Any ideas?

-Jerry

The other thing I've noticed is that the data sent out is always one byte
less than what MyData is. So for the above I only get "1234567890AB". My
example is exactly the same as on the MSDN site, so could this be a bug?

-Jerry
 
Back
Top