Go Back   RunUO - Ultima Online Emulation > RunUO > Core Modifications > Other

Other Cant find a category above, use this one! Core mods not listed above go here!

Reply
 
Thread Tools Display Modes
Old 09-29-2005, 06:15 PM   #1 (permalink)
 
Join Date: Aug 2005
Location: United Kingdom! England!
Age: 17
Posts: 37
Send a message via MSN to Ricky26
Default A different type of packet...

I seem to have a problem... The packets in Hostile Space contain more than one command...

i.e.

packet
{
command { type, length, data }
command { type, length, data }
...
} // This is make-believe script.. xD

or for Hex ppl

0x02 0x02 0xDA 0xTA 0x02 0x02 0xDA 0xTA

But RunUO just ditches the commands other than the first, can someone, PLEASE help me. Im very lost at whats goin on...

Ricky26,
Ricky26 is offline   Reply With Quote
Old 09-29-2005, 06:46 PM   #2 (permalink)
The noob formerly known as Jakob
 
Serp's Avatar
 
Join Date: Jan 2005
Posts: 316
Default

TCP guarantees that your data will arrive on the other side in the same order that you sent it, and that all data will actually arrive. The data is delivered as a stream, not individual packets. Let's say you receive the sequence
0x02 0x02 0xDA 0xTA 0x02 0x02 0xDA 0xTA
Now it's up to you to parse this.
The number of bytes received is >= 1, so you can get the packet identifier. In this case, it is 0x02. You know that this packet is of dynamic length (either by using a lookup table, or just having the protocol guarantee you that all packets are of dynamic length). If the number of received bytes is >= 2, you can read the next byte and get the length of the data. The length of the data in this case is 0x02. If the number of received bytes is >= 2+0x02, then you can extract the packet from your receive buffer and handle it.
After you've handled it you go back to the receive buffer and see if you have enough data to handle the next packet and if you don't wait for more data to arrive before checking again.
RunUO does all this, so unless you removed too much in your modifications, it will still be there.
If you're making your own network handling code, I advise you to make use of RunUO's ByteQueue. It's proven very useful for me in the past for keeping track of the number of received bytes, the next buffered packet's identifier etc :-)
Serp is offline   Reply With Quote
Old 09-30-2005, 03:19 AM   #3 (permalink)
 
Join Date: Aug 2005
Location: United Kingdom! England!
Age: 17
Posts: 37
Send a message via MSN to Ricky26
Default

I know about TCP streams ^_^. But RunUO seems to be parsing the first command and not the second... The second being the logon command, which means the game doesnt load....

Aha! Ive found something that may be of use...

In MessagePump.Slice(), the queue doesnt contain the second command, allthough the Netstate buffer does...

EDIT: Sorry about the previous post, I was kinda tired and angry...
Ricky26 is offline   Reply With Quote
Old 09-30-2005, 10:37 AM   #4 (permalink)
 
Join Date: Aug 2005
Location: United Kingdom! England!
Age: 17
Posts: 37
Send a message via MSN to Ricky26
Unhappy

Any ideas? Because I'm not looking forward to re-coding the RunUO packet system...

Detail:

RunUO receives two packets..

It adds the stream to the queue.

Stream is dequeued.

First packet is parsed.

Second packet is released.. (Not good...)
Ricky26 is offline   Reply With Quote
Old 09-30-2005, 05:10 PM   #5 (permalink)
 
Join Date: Aug 2005
Location: United Kingdom! England!
Age: 17
Posts: 37
Send a message via MSN to Ricky26
Talking *solved*

It seems windows doesnt like it when packets end with 0s.

Example:

0x76 0x08 0x00 0x1c 0x00 0x00 0x00 0x00 0x00 0x00

would be truncated to 0x76 0x08 0x00 0x1c

and then the next packet would add on at the end... Not only invalidating that packet, but practically all the once afterwards....

E.G.

0x76 0x08 0x00 0x1c 0x02 0x06 0xDA 0xTA 0xDA 0xTA 0xDA 0xTA

(DA is not a valid packet type, and TA isnt a valid length...)

Minor h4x0r1ng fixed this... Im sorry I ever blamed you... *hugs runUO*

*gets cane to beat microsoft*
Ricky26 is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5