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 , 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 ???

I can get around it by just spamming the address space as its small, ie have a loop that sends the message to , then , 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 lands you in Kansas.

oups… I use for broadcast , Apple use to

Sort of solved, if I use an address of thats works fine, But UDPSocket1.BroadcastAddress returns which is blocked.
Using wireshark, I can see drop box using , 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 Subnetmask

The method for calculating a specific broadcast address isn’t too difficult. But keep in mind, the reason we use 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 = “”
dim subnetmask as string = “”

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”)

dim broadcastAddress as string = join(bc,".")

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 !