from that snippet, i would have thought it will be sent as 2 seperate packets.
here is a code sample from one of my old projects, written with indy (not sure what version)
[pascal]type
TInSimPacket =packed record // General purpose 8 byte UDP packet
Id: Array[0..3] of Char; // 3 character identifier followed by zero character
Value: Integer; // 32 bit value depending on the type of InSimPack
end;
TRST_Packet =packed record // Race Start
RST: Array[0..3] of Char;
RaceLaps: Byte; // 0 if qualifying
QualMins: Byte; // 0 if race
NumInRace: Byte;
Spare: Byte;
Track: Array[0..5] of Char;
Weather: Byte;
Wind: Byte;
Sp0: Byte;
Sp1: Byte;
VerifyId: Word;
end;
procedure TInSim.UDPRead(Sender: TObject; AData: TStream; ABinding: TIdSocketHandle);//this is an event from indy
var
InSimPacket: TInSimPacket;
RST_Packet: TRST_Packet;
Begin
AData.Position := 0;
AData.ReadBuffer(InSimPacket, SizeOf(InSimPacket));
AData.Position := 0;//reset the position back to the start of the packet
if InSimPacket.Id = 'RST' then
Begin
AData.ReadBuffer(RST_Packet, SizeOf(RST_Packet));
InSimPacket.Id := 'ACK'+#0;
InSimPacket.Value := RST_Packet.VerifyId;
UDPServer.SendBuffer(FHost, FHostPort, InSimPacket, SizeOf(InSimPacket));
if Assigned(FOnRaceStart) then
FOnRaceStart(RST_Packet);
end;
end;
[/pascal]
and this is how something is sent
[pascal]type
TSingleChar_Packet =packed record // send to LFS to simulate single character
Id: Array[0..3] of Char; // SCH + zero
C: Char; // key to press
Flags: Byte; // bit 0 : SHIFT / bit 1 : CTRL
Spare2: Byte;
Spare3: Byte;
end;
procedure TInSim.SendChar(C: Char; Flags: Byte);
var
SingleChar_Packet: TSingleChar_Packet;
Begin
if not FConnected then
Exit;
SingleChar_Packet.Id := 'SCH' + #0;
SingleChar_Packet.C := C;
SingleChar_Packet.Flags := Flags;
SingleChar_Packet.Spare2 := 0;
SingleChar_Packet.Spare3 := 0;
UDPServer.SendBuffer(FHost, FHostPort, SingleChar_Packet, SizeOf(SingleChar_Packet));
end; [/pascal]
Bookmarks