UDPsocket broadcast problem.

I have a network of computers(25 of them). all in the 10.0.0.(1-200) local network IP range.
When I use
UDPSocket1.BroadcastAddress and send out a datagram it works fine from all of the computers but one, which wont send a UDP broadcast.
No error is generated, it just doesnt send it.
This computer will happily send a UDP datagram to another distinct IP ie 10.0.0.116 , but when the address is the broadcast address, it doesnt send.

It can receive UDP broadcasts from other computers fine.

Any ideas? I suspect some firewall setting thats blocking UDP broadcasts from being sent, but letting normally addressed UDP datagrams through.

Also is the UDPSocket1.BroadcastAddress always 255.255.255.255 ???

I can get around it by just spamming the address space as its small, ie have a loop that sends the message to 10.0.0.1 , then 10.0.0.2 , 10.0.0.3 etc
As its a fast network and the message is small its not a big deal.

Have you tried using a different multicast group name? It could be that the address it translates to is in use on that machine.

it’s better to not use 10.0.x.x range, is used by Apple Airport/TimeCapsule when DHCP is activated. Better to use 228.0.x.x

Excuse my ignorance, but is that not a routable ip range?

EDit - for example 228.0.23.0 lands you in Kansas.

oups… I use 10.255.1.2 for broadcast , Apple use 10.0.0.0 to 10.10.255.255

Sort of solved, if I use an address of 10.255.255.255 thats works fine, But UDPSocket1.BroadcastAddress returns 255.255.255.255 which is blocked.
Using wireshark, I can see drop box using 10.255.255.255 , so I’m guessing thats the Broadcast address I should use.
As I need this work on any small network, Ill have to find a way of calculating the broadcast address.
Is this a XOJO bug? or am I missing something here.

computer ip 10.0.0.142 Subnetmask 255.0.0.0

The method for calculating a specific broadcast address isn’t too difficult. But keep in mind, the reason we use 255.255.255.255 by default is that it’s not routable. That means that on a corporate network where there may be many different subnets connected by routers, your UDP broadcasts will never leave the network you are on.

Ok, now for the calculation:

In your case it’s pretty simple. Any places you have a 0 in the subnet mask, you replace it with a 255 in the IP address.

If your subnet mask is more specific (not an even 0 or 255) you’d need to do some bitwise operations.

From Wikipedia:

Here’s some code that shows one way to do this…

[code]dim ipaddress as string = “172.16.32.51”
dim subnetmask as string = “255.240.0.0”

dim ip() as string = split(ipaddress,".")
dim sn() as string = split(subnetmask,".")
dim bc() as string

for i as integer = 0 to 3
dim ipseg as integer = val(ip(i))
dim snseg as integer = 255 - val(sn(i))

dim newseg as integer = ipseg or snseg

bc.Append str(newseg,“0”)
next

dim broadcastAddress as string = join(bc,".")
break[/code]

Thanks Greg, ! I think I will use the default broadcast , and use the calculated broadcast address and resend on that. Creats a little more network traffic but more robust. Thanks for the code snippet, very clear !