Hi Francois,
Where do you exactly have this demo?
I can't find it in my component folder.
I unfortunately still don't understand this!
I just want to add the available data into the memo, what all other
things are?
Is there any help somewhere?
thanks
-daniel
On 2.12.2010 15:42, Francois PIETTE wrote:
How do you exactly call this?
"call ReceiveFrom to get data."
Extracted from sample program OverbyteIcsUdpLstn1.pas:
procedure TMainForm.WSocketDataAvailable(Sender: TObject; Error: Word);
var
Buffer : array [0..1023] of AnsiChar;
Len : Integer;
Src : TSockAddrIn;
SrcLen : Integer;
begin
SrcLen := SizeOf(Src);
Len := WSocket.ReceiveFrom(@Buffer, SizeOf(Buffer), Src, SrcLen);
if Len >= 0 then begin
if (FSenderAddr.S_addr = INADDR_ANY) or
(FSenderAddr.S_addr = Src.Sin_addr.S_addr) then begin
Buffer[Len] := #0;
DataAvailableLabel.Caption :=
IntToStr(atoi(DataAvailableLabel.caption) + 1) +
' ' +
String(StrPas(inet_ntoa(Src.sin_addr))) +
':' +
IntToStr(ntohs(Src.sin_port)) +
'--> ' + String(StrPas(Buffer));
end;
end;
end;
--
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