I don't really know what the problem is but I think you do something
A simple .Send to 255.255.255.255 is enought, then OnDataSent do a .Close
why use a TTimer ?
ST> I'm trying to create application that would run on multiple machines.
ST> This application has to know IP addresses of all other machines running
ST> same software.
ST> I'm trying to do something like discovery on network. Protocol I decided
ST> to use for discovery is UDP. On mailing list I already saw, that only
ST> one TWSocket component
ST> can be used for receiving and sending data. So, I wrote following code
ST> for listening:
ST> UDPSocket.Proto :='udp';
ST> UDPSocket.Addr :='0.0.0.0';
ST> UDPSocket.Port :='1234';
ST> Timer1.Enabled :=True;
ST> and on timer event there is code for sending broadcast data to notofy
ST> others about existence:
ST> procedure TForm1.Timer1Timer(Sender: TObject);
ST> SendTo.sin_port :=htons(1234);
ST> SendTo.sin_addr :=StrToInAddr('255.255.255.255');
ST> SendTo.sin_family :=AF_INET;
ST> StrToInAddr is function that I found in mailing list.
ST> On receive even I have code from udplistener sample:
ST> Buffer : array [0..1023] of char;
ST> Len : Integer;
ST> Src : TSockAddrIn;
ST> SrcLen : Integer;
ST> SrcLen := SizeOf(Src);
ST> Len := WSocket.ReceiveFrom(@Buffer, SizeOf(Buffer), Src, SrcLen);
ST> if Len >= 0 then begin
ST> Buffer[Len] := #0;
ST> Problem is that sending is ok (no error), but ondataavaliable event
ST> never gets fired, so I'm assuming that nothing is sent.
ST> What am I doing wrong.
ST> P.S. I have been using ICS for awhile now and I think that this is most
ST> stable component suite for networking. Keep the good work.
ST> Skok Tone
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be