Newsgroups : Borland : borland.public.delphi.internet.winsock : 2008 Apr : UDP Broadcast
| Subject: | UDP Broadcast |
| Posted by: | "Michael Stieler" (michael.stiel..@rie.eu) |
| Date: | Thu, 17 Apr 2008 14:03:42 |
Hi,
I successfully use an UDP Broadcast to detect devices in the network.
The Indy version is 9.0.18, the code looks like this:
// Initialize
IdUDPServer1 := TIdUDPServer.Create(self);
IdUDPServer1.OnUDPRead := IdUDPServer1UDPRead;
IdUDPServer1.BroadcastEnabled := True;
IdUDPServer1.ThreadedEvent := True;
// Send Broadcast
try
IdUDPServer1.Active := true;
IdUDPServer1.Broadcast(message, port);
except on Exception do
// could be a firewall problem
end;
Now I have been told that the broadcast only works with only one network
interface, so it is a problem for users with multiple network cards.
In Indy doc there is a hint to .Bindings property, but how to use it?
Loop over each item and broadcast to every binding?
Michael