Making sense of multiple packets containing dup data

R

Randy General

I'm currently working on a query app for Battlefield 2142 and I'm
running into some troubles when I'm receiving multiple UDP packets from
a server. When there's only one packet, I can decipher it without much
trouble, as it's rather predictable. However, when the data has to
arrive in multiple packets things get much tougher, here's why:

- If it's at the end of one packet and in the midst of transferring a
piece of data (e.g. a player's ID, a player's name, etc) it will
re-write that entire piece of data in the next packet, even the part
that was previously written in the last packet.

- Different parts of the packet are categorized, e.g. players_ precedes
all of the player names, scores_ precedes player scores, etc. However,
if it's in the midst of reporting players_ at the end of a packet, it
will re-write players_ again at the start of the next packet. This tends
to make it difficult for me to have a pattern for parsing the packets as
they can vary a bit between each query.

I've tossed together a basic script to query several servers and output
the results so you can see what it looks like when there's varying
amounts of packets:

http://pastie.org/539099.txt

I've only been programming for a few days, so excuse any terrible coding
practices in there ;)

Any assistance would be tremendously appreciated!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top