Yeah, I've worked a lot with TCP and it was really no problem requesting a
next packet after each, it was very fast.
UDP offers some other valuable features though.
How do you manage missed/double/wrong ordered packets? I thought of making a
buffer to store a certain amount of packets.. say...
How do you manage missed/double/wrong ordered packets?
Each packet got some sequence ID and alive packets were sent from time
to time. Also there was no special acknowledge packet - each received
packet contained the last successful received ID of the sender. If one
side detects that an
Hi, I checked it out, that's quite confusing heh. I'd appreciate it if you
could show me a simple code for a UDP wsocket to Listen; and send data back
to the host it received from.
Thanks!
--
To unsubscribe or change your settings for TWSocket mailing list
please goto
Hello Brian,
Not tested. This echo back a received packet from a listening UDP socket
to the other end:
var
Buffer: array [0..1023] of char;
Len: integer;
Src: TSockAddrIn;
SrcLen: integer;
begin
SrcLen := SizeOf(Src);
Len := FUDPServer.ReceiveFrom(@Buffer, SizeOf(Buffer),
Thanks, that's really helpful! (only missed the pointer to the buffer in
that code)
it seems acknowledging every packet with udp before sending more turns out
much slower than tcp
--
To unsubscribe or change your settings for TWSocket mailing list
please goto
I thought the fragmented packets didn't happen with UDP though? that
boundaries were respected?
At the application level, there is no fragmented packet, datagram boundaries
are respected.
Why is the event triggered with empty data?
Are you calling the message pump from one of your event
Hello brian,
I thought the fragmented packets didn't happen with UDP though? that
boundaries were respected?
Yes boundaries are respected with UDP. Don't make your packets too
large. Look at internal buffer of TWSocket.
Why is the event triggered with empty data?
I don't know. Using TCP
This is the simple test code to receive the data
procedure TForm1.WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
begin
Inc(rec,1);
caption:= 'Received packets = '+inttostr(rec);
memo1.lines.add(WSocket2.ReceiveStr);
end;
Are you calling the message pump from one of your event
sorry, actually it's this
procedure TForm1.WSocket2DataAvailable(Sender: TObject; ErrCode: Word);
Var a: string;
begin
a:= WSocket2.ReceiveStr;
// if length(a) = 0 then Exit;
Inc(rec,1);
caption:= 'Received packets = '+inttostr(rec);
memo1.lines.add('Data: '+a);
end;
--
To unsubscribe or
Can I send data back with the same udp socket that I set to listen?
Yes.
Look at my IP Log Streaming Component using ICS, it includes a demo for
that can acts as TCP or UDP, client or server, bouncing packets around.
http://www.magsys.co.uk/delphi/magics.asp
Angus
--
To unsubscribe or
10 matches
Mail list logo