Where do you exactly have this demo?
I can't find it in my component folder.
The demos are not in the component folder (vc32) but in the "Internet"
folder.
I unfortunately still don't understand this!
I just want to add the available data into the memo, what all other things
are?
if (FSenderAddr.S_addr = INADDR_ANY) or
(FSenderAddr.S_addr = Src.Sin_addr.S_addr) then begin
The demo is made to accept either data from everywhere (FSenderAddr.S_addr =
INADDR_ANY) or data from a specific IP address linked to a TEdit
(FSenderAddr.S_addr = Src.Sin_addr.S_addr). If you don't want this
filtering, youi can just drop the condition:
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
Buffer[Len] := #0;
DataAvailableLabel.Caption :=
IntToStr(atoi(DataAvailableLabel.caption) + 1) + // Counter
' ' +
String(StrPas(inet_ntoa(Src.sin_addr)))
+ /: Sender's IP address
':' +
IntToStr(ntohs(Src.sin_port)) + // Sender's port
'--> ' + String(StrPas(Buffer));
// Received data
end;
end;
Is there any help somewhere?
Source code comments, this mailing list and http://wiki.overbyte.be
--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
----- Original Message -----
From: "Signed Source® Project" <dan...@signedsource.com>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Thursday, December 02, 2010 4:28 PM
Subject: Re: [twsocket] TWSocket UDP capturing
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
--
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