Delphi里面也有UDP的例子,不过是NMUDP,用法差不多
Send:
var
MyStream: TMemoryStream;
MyStream := TMemoryStream.Create;
MyStream.Write(@s,Length(s));
UDP1.SendStream(MyStream);
Receive:
procedure OnUDP1DataReceived(....)
var
MyStream: TMemoryStream;
MyStream := TMemoryStream.Create;
MyStream.Read(@s,NumberBytes);