View Full Version : ACK Packet error on Result packet
CrazyICE
2nd November 2005, 10:37
i always get an ACK error ("InSim : ACK for unknown packet"), when sending an ACK packet after getting a result packet.
Here a short part of my logfile
02.11.2005 11:23:57: ACK for Result Packet sent
02.11.2005 11:23:57: KR|Thomas Facklam hat das Rennen gewonnen
02.11.2005 11:23:57: InSim : ACK for unknown packet
02.11.2005 11:24:01: ACK for Result Packet sent
02.11.2005 11:24:01: InSim : ACK for unknown packet
02.11.2005 11:24:03: ACK for Lap Packet sent
02.11.2005 11:24:03: ACK for New Player (join) Packet sent
02.11.2005 11:24:03: ACK for New Player (join) Packet sent
02.11.2005 11:24:03: ACK for New Player (join) Packet sent
02.11.2005 11:24:03: ACK for New Player (join) Packet sent
02.11.2005 11:24:03: ACK for New Player (join) Packet sent
02.11.2005 11:24:03: ACK for New Player (join) Packet sent
02.11.2005 11:24:03: ACK for New Player (join) Packet sent
02.11.2005 11:24:03: ACK for New Player (join) Packet sent
02.11.2005 11:24:03: ACK for New Player (join) Packet sent
02.11.2005 11:24:03: ACK for New Player (join) Packet sent
02.11.2005 11:24:03: ACK for New Player (join) Packet sent
02.11.2005 11:24:04: ACK for New Player (join) Packet sent
02.11.2005 11:24:04: ACK for New Player (join) Packet sent
02.11.2005 11:24:04: ACK for New Player (join) Packet sent
02.11.2005 11:24:04: ACK for New Player (join) Packet sent
02.11.2005 11:24:04: ACK for New Player (join) Packet sent
02.11.2005 11:24:04: ACK for Split Packet sent
02.11.2005 11:24:04: Octrin.cr4zy!C3 kommt mit einer Runde Rückstand ins Ziel
02.11.2005 11:24:05: ACK for Result Packet sent
02.11.2005 11:24:05: InSim : ACK for unknown packet
(the whole log file is attached, start at line 1501)
why?
and why do I always get a NPL packet after getting the result packet?
CrazyICE
2nd November 2005, 11:39
i think i get the wrong VerifyID:
02.11.2005 12:02:00: ACK for Result Packet sent (ID: 4)
02.11.2005 12:02:00: ACK for Result Packet sent (ID: 4)
02.11.2005 12:02:00: ACK for Result Packet sent (ID: 4)
02.11.2005 12:02:00: ACK for Result Packet sent (ID: 4)
02.11.2005 12:02:00: ACK for Result Packet sent (ID: 4)
02.11.2005 12:02:00: ACK for Result Packet sent (ID: 4)
02.11.2005 12:02:00: ACK for Result Packet sent (ID: 4)
02.11.2005 12:02:00: InSim : ACK for unknown packet
02.11.2005 12:02:00: InSim : ACK for unknown packet
02.11.2005 12:02:00: InSim : ACK for unknown packet
02.11.2005 12:02:00: InSim : ACK for unknown packet
02.11.2005 12:02:00: InSim : ACK for unknown packet
02.11.2005 12:02:00: InSim : ACK for unknown packet
02.11.2005 12:02:00: InSim : ACK for unknown packet
02.11.2005 12:02:02: ACK for Result Packet sent (ID: 4)
02.11.2005 12:02:02: InSim : ACK for unknown packet
02.11.2005 12:02:03: ACK for Result Packet sent (ID: 4)
02.11.2005 12:02:03: InSim : ACK for unknown packet
02.11.2005 12:02:03: ACK for Result Packet sent (ID: 4)
02.11.2005 12:02:03: ACK for Result Packet sent (ID: 4)
02.11.2005 12:02:03: ACK for Result Packet sent (ID: 4)
02.11.2005 12:02:03: InSim : ACK for unknown packet
02.11.2005 12:02:03: InSim : ACK for unknown packet
02.11.2005 12:02:03: InSim : ACK for unknown packet
02.11.2005 12:02:04: InSim : discarding unacknowledged packet (1031)
02.11.2005 12:02:04: InSim : discarding unacknowledged packet (1032)
02.11.2005 12:02:04: InSim : discarding unacknowledged packet (1033)
02.11.2005 12:02:04: InSim : discarding unacknowledged packet (1034)
02.11.2005 12:02:04: InSim : discarding unacknowledged packet (1035)
02.11.2005 12:02:04: InSim : discarding unacknowledged packet (1036)
02.11.2005 12:02:04: InSim : discarding unacknowledged packet (1037)
it seems that i get always the ID 4 instead of 1031, 1032...1037.
why? i don't understand!
Frankmd
2nd November 2005, 12:10
If you dont post the code you use to get the verifyId from the packet we cant tell you why it is always 4. Maybe you havent counted right, and the verfiyId is the bit after or before the one that is always 4.
byte ResultNum; // position in results table (qualify may be inserted not at end)
byte NumResults; // total number of results (qualify doesn't always add a new one)
word VerifyId;
Maybe you are reading the NumResults?
EDIT: since verifyId is the last bit, I suppose you are reading the NumResults, or maybe just the first bit of verifyId? verifyId should be bit 106 and 107 (where the first one is 0).
CrazyICE
2nd November 2005, 12:57
here is the (delphi) code i use:
Procedure which is called if an result packet was sent:
procedure TfMain.DoRESPacket(AUDPData: TStream); //Result Packet
var InSimResult: TRES_Packet;
begin
AUDPData.Read(InSimResult, SizeOf(TRES_Packet));
SendAckPacket(InSimResult.VerifyId, UDPClient);
lbAppMsg.ItemIndex:= lbAppMsg.Items.Add(DateTimeToStr(now)+ ': ACK for Result Packet sent (ID: '+ IntToStr(InSimResult.VerifyId)+ ')');
end;
And here is the structure of TRES_Packet:
TRES_Packet =packed record //RESult (qualify or finish)
RES: Array[0..3] of Char;
UName: Array[0..23] of Char; // username
PName: Array[0..23] of Char; // nickname
Plate: Array[0..7] of Char; // number playte - NO ZERO AT END
CName: Array[0..4] of Char; // car name
Spare: Array[0..23] of Char; // zero
LapsDone: Word; // laps completed
Flags: Word; // player flags : help settings etc - see below
ConfirmFlags: Byte; // confirmation flags : disqualified etc - see below
NumStops: Byte; // number of pit stops
bType: Byte; // bit 0 - female / bit 1 - ai
UniqueId: Byte; // unique id : 0 = player already left before result was sent
TotalTime: TMSHT; // 4-byte minutes, seconds, hundredths, thousandths
BestLap: TMSHT; // 4-byte minutes, seconds, hundredths, thousandths
ResultNum: Byte; // position in results table (qualify may be inserted not at end)
NumResults: Byte; // total number of results (qualify doesn't always add a new one)
VerifyId: Word;
end;
And AUDPData is provided by a UDP Component called IdUDPServer which handles all UDP things...
Here is the code how i handle incoming UDP packets:
procedure TfMain.UDPServerUDPRead(Sender: TObject; AData: TStream; //Read UDP Data by LFS
ABinding: TIdSocketHandle);
var InSimPacket: TInSimPacket;
begin
AData.Position := 0;
AData.ReadBuffer(InSimPacket, SizeOf(InSimPacket));
AData.Position := 0;
// ************** //
// Common Packets //
// ************** //
//RaceTime
if InSimPacket.Id = 'RTP' then DoRTPPacket(AData);
//Version Info
if InSimPacket.Id = 'VER' then DoVERPacket(AData);
//Acknowledge
if InSimPacket.Id = 'ACK' then DoACKPacket(AData);
//State Info
if InSimPacket.Id = 'STA' then DoSTAPacket(AData);
//Message by LFS
if InSimPacket.Id = 'MSO' then DoMSOPacket(AData);
//User Messages
if InSimPacket.Id = 'MSS' then DoMSSPacket(AData);
// ********************* //
// Race Tracking Packets //
// acknowledged //
// ********************* //
//Race Restart
if InSimPacket.Id = 'RST' then DoRSTPacket(AData);
//Race End
if InSimPacket.Id = 'REN' then DoRENPacket(AData);
//New Connection
if InSimPacket.Id = 'NCN' then DoNCNPacket(AData);
//Connection leave
if InSimPacket.Id = 'CNL' then DoCNLPacket(AData);
//Player joined
if InSimPacket.Id = 'NPL' then DoNPLPacket(AData);
//Player pitts
if InSimPacket.Id = 'PLP' then DoPLPPacket(AData);
//Player leave (==> Spectate Mode)
if InSimPacket.Id = 'PLL' then DoPLLPacket(AData);
//Player rename
if InSimPacket.Id = 'CPR' then DoCPRPacket(AData);
//Clear Race
if InSimPacket.Id = 'CLR' then DoCLRPacket(AData);
//Lap time
if InSimPacket.Id = 'LAP' then DoLAPPacket(AData);
//Split Info
if (InSimPacket.Id = 'SP1') or
(InSimPacket.Id = 'SP2') or
(InSimPacket.Id = 'SP3') then DoSPXPacket(AData);
//Result
if InSimPacket.Id = 'RES' then DoRESPacket(AData);
//Reorder
if InSimPacket.Id = 'REO' then DoREOPacket(AData);
// ********************* //
// Race Tracking Packets //
// not acknowledged //
// ********************* //
//Node Lap
if InSimPacket.Id = 'NLP' then DoNLPPacket(AData);
//Multi Car Info
if InSimPacket.Id = 'MCI' then DoMCIPacket(AData);
end;
Frankmd
2nd November 2005, 14:19
I've never worked with Delphi, but I assume that getting the data from the UDP packet is done automatically, by saying that it is a TRES packet? So it will get the first 4 bytes and call it RES, and the the next 24 bytes are put into UName?
Or do you have additional code that handles that?
CrazyICE
2nd November 2005, 14:36
no...it is all "saved" in AData as a Stream...
so, I can read the data directly into the Result record (TRES_Packet)...
so i relly don't understand why i always get wrong VerifyIDs...
it seems that they are wrong...
Silkswift
2nd November 2005, 14:49
I think your error is here:
CName: Array[0..4] of Char; // car nameIt should be Array[0..3], it's 1 Char too big, meaning you're shifting all the values later on. So, you were indeed reading the NumResults value, instead of the VerifID.
CrazyICE
2nd November 2005, 14:55
ohhh....
you're right...
damn...i'm an idiot :)
thx!
going to try...
ok, it works...thx for finding my stupid errors :)
02.11.2005 15:57:50: ACK for Result Packet sent (ID: 560)
02.11.2005 15:58:05: ACK for Result Packet sent (ID: 778)
02.11.2005 15:58:05: ACK for Result Packet sent (ID: 779)
02.11.2005 15:58:05: ACK for Result Packet sent (ID: 780)
02.11.2005 15:58:05: ACK for Result Packet sent (ID: 781)
02.11.2005 15:58:05: ACK for Result Packet sent (ID: 782)
02.11.2005 15:58:05: ACK for Result Packet sent (ID: 783)
02.11.2005 15:58:05: ACK for Result Packet sent (ID: 784)
02.11.2005 15:58:09: ACK for Result Packet sent (ID: 818)
02.11.2005 15:58:12: ACK for Result Packet sent (ID: 871)
02.11.2005 15:58:15: ACK for Result Packet sent (ID: 889)
02.11.2005 15:58:15: ACK for Result Packet sent (ID: 890)
02.11.2005 15:58:15: ACK for Result Packet sent (ID: 891)
Scawen
2nd November 2005, 14:58
I've had a look in the code and can't see how the VerifyID (last two bytes of the packet) could go wrong, if any other verified packet is ever correct, because it goes through exactly the same code in all cases.
Could you log the contents of the actual UDP packet that you are receiving, and paste it here?
[ EDIT : ah... ok... forget what i said :D ]
xaotik
2nd November 2005, 15:05
ohhh....
you're right...
damn...i'm an idiot :)
thx!
going to try...
Does this mean that InSim RaceAnalyser (http://lfstools.crazyice.net/pafiledb/pafiledb.php?action=file&id=69) is going to get an update? :)
CrazyICE
2nd November 2005, 15:06
I've had a look in the code and can't see how the VerifyID (last two bytes of the packet) could go wrong, if any other verified packet is ever correct, because it goes through exactly the same code in all cases.
Could you log the contents of the actual UDP packet that you are receiving, and paste it here?
[ EDIT : ah... ok... forget what i said :D ]
ok, i will ;) hehehehehe
but thx scawen...great support!
Does this mean that InSim RaceAnalyser (http://lfstools.crazyice.net/pafiledb/pafiledb.php?action=file&id=69) is going to get an update? :)
maybe later, but for now, only AutoMessage will be updated...
RA need a big update :)
Frankmd
2nd November 2005, 15:58
Hm, so was InSim was changed from S1 to S2? Because in the S1 insim.txt I read this:
char CName [32]; // car name
EDIT: oh, that was the Space part, never mind :)
Silkswift
2nd November 2005, 17:16
Hm, so was InSim was changed from S1 to S2? Yes, a few of the packets were changed, in particular the RES one. The total size of the packet didn't change, but the fields inside did somewhat.
Frankmd
2nd November 2005, 17:29
Ok, but where can I get the new InSim.txt file? Afaik it doesnt come with 0.5P, so I am still using the S1 file...
CrazyICE
2nd November 2005, 17:33
the new structure is given with S2 i think...
look in docs folder!
current InSim.txt
Frankmd
2nd November 2005, 17:52
:tilt: docs folder....
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.