Talk:Protocol FAQ

From wiki.vg
Revision as of 15:07, 13 December 2011 by Barneygale (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Hey, I have a different problem. Whenever I attempt to log-in to my server, I receive an IOException entitled "Received string length is less than zero! Weird string!"

Currently all my server is doing after the login request is successful is (in this order): - Streaming relevant 49 chunks - Sending the Compass packet - Sending the inventory slot packets - Sending the player position & look packet

It gets stuck on the chunk packets, so I know it's a problem there. I am not sending pre-chunks, because the protocol said it wasn't necessarily obligatory. I'm going to try sending those now, and see if it fixes it. Aside from that, anyone have any ideas? :/

UPDATE: I've fixed this, but now, it gets stuck on the byte which sends 16 - 1 (15) and it's telling me Bad packet id 15, as if it is trying to make that byte a packet itself, rather than part of the chunk packet. Removing this causes another error, telling me that the string is over the max limit (this is part of the compressed data being sent to the client.) I don't really know what is wrong. Here's my code for writing the 0x33 packet message from S->C http://pastebin.com/A25u25eD

Probably a problem with a previous packet you've sent, then. Dump what your server is sending and upload somewhere. Barneygale 09:00, 28 November 2011 (MST)
This is the downstream packet I'm sending (header 33, which is identified in the documentation as the packet to send detailing a chunk.: http://pastebin.com/A25u25eD
Hey, please help me out with this (lol) if you can you. It kinda makes me have to stop my project entirely, as I can't continue with chunk distribution, and that is my primary focus right now. Thanks :p haha
Again, you'll need to dump what your server is sending so we can analyse it. Just write your raw bytes to a file. Use wireshark if you have to Barneygale 21:54, 5 December 2011 (MST)
Ah, I see. Sorry, misunderstood your question. I wrote the bytes from my ChannelBuffer (see the Netty networking library's API, it's in the org.jboss.netty.buffer package) using the ChannelBuffer#array() method to a text file. Here you go: http://www.mediafire.com/?bb665aj7i4uhjt5
Er, what's this data? I don't see any 0x33, 0x32. Server data should start with a 0x02 for the handshake, yours starts with two keep-alives, then a 0x0F player block placement with an invalid direction. What exactly am I looking at? Barneygale 21:44, 7 December 2011 (MST)
Don't really understand how to dump this with the api I'm using. I'm sending handshake->login request->pre-chunk->chunk data at the moment, and I showed you what it's writing in the chunk data packet. What else do you need exactly? :o
I already mentioned that your issue is likely with a previous packet. If possible, just dump everything your server is sending to your client. Use wireshark if you can't do it from the program itself. Barneygale 17:16, 10 December 2011 (MST)
Additionally this will be much easier to solve if you come on IRC - irc.freenode.net #mcdevs Barneygale 20:47, 10 December 2011 (MST)
You're not on the IRC at the moment, but I'll try to use wireshark to dump it all. Thanks for your time!
Here's the Wireshark dump: http://www.mediafire.com/?hyy89jbrimxywq2
Cleaned up hex dump: https://gist.github.com/1468145
Parsed data: https://gist.github.com/1468147
Note, 7f 0f remains on the server->client buffer
After the client sends a login (0x01), your data doesn't make any sense Barneygale 09:49, 12 December 2011 (MST)
Looks to me like you're sending 32 and 33 as decimal values for your Pre-Chunk and Chunk packets, hence them showing up as 0x20 and 0x21 in the hex dump. Additionally, you're not sending the Compressed Size and Compressed Data fields for the Map Chunk (0x33) packet Barneygale 09:55, 12 December 2011 (MST)
(and you need to send 0x01 Login) Barneygale 10:03, 12 December 2011 (MST)
I completely forgot about the fact that they were hexadecimal rather than just normal bytes. Also, I removed everything after the byte that was causing errors because I was messing around with the packet to see if it was inside the packet. It all makes sense now. I'll try converting my packet headers to hexadecimal and see if that clears things up. (it would make sense)
Well, I'm still getting the error. Do I have to change anything in my encoder? My process for packets is one where the packet header is saved as an int, and then when packets are queued to be sent to the client, the header is written (one byte, the int that was saved) and the payload follows. Same error. I changed all my packets to add the 0x prefix, and if it was a single digit it was prefixed with 0x0. Is there something I'm missing here? :/ Tonight I can't look further into it because I'm extremely busy, but I will check back tomorrow. Thank you for your time, I'm sorry I'm being such a pain >.< I'll ask a friend to try and login tomorrow so I can give you another result to examine.
I'm totally lost as to what your problem is. Store your packet types as bytes. Specify them in hex, i.e. when writing a packet, do buf.writeByte(0x32) rather than buf.writeByte(32). Wireshark should be your go-to tool for debugging - filter by tcp.port==25565, find a packet, right click > follow TCP stream Barneygale 08:07, 13 December 2011 (MST)