Hello all,
I'd like to send an UDP broadcast to "255.255.255.255" using
tudpBlockSocket.
Unfortunately this fails if the computer has more than 1 network
card.
What can I do?
The code I use is this:
Procedure Test;
Var
Sock : TUDPBlockSocket;
s, t, remoteip: ansistring;
start, dauer : dword;
Begin
try
Sock := TUDPBlockSocket.Create;
sock.EnableBroadcast(true);
t := '30833';
sock.Connect('255.255.255.255', t);
sock.SendString('Hello');
start := GetTickCount;
Repeat
s := sock.recvpacket(500);
If s <> '' Then
Begin
remoteip := iptostr(ntohl(sock.RemoteSin.sin_addr.s_addr));
DoSomething;
End; //if s<>''
dauer := (gettickcount - start);
Until (dauer > 2000);
sock.free;
Except End;
End;
yours truly,
Arthur Hoornweg
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public