Kworz / MC-PE-Server

Small c++ mcpe server using raknet library
http://mcpeserver.hwxmca.fr/
Mozilla Public License 2.0
3 stars 2 forks source link

More work? #4

Closed lukeeey closed 7 years ago

lukeeey commented 7 years ago

Will you continue to work on this by adding packet handling?

lukeeey commented 7 years ago

I'm also not sure how to decode the unconnected ping packet then send the unconnected pong packet :/

Kworz commented 7 years ago

the unconnected ping response is done natively by RakNet

Server.cpp : PeerInterface->SetOfflinePingResponse(message.c_str(), message.size());

lukeeey commented 7 years ago

Well clearly not, since the client sends a 0x01, which i need to read a long from and then send a 0x1c with that long. Apparently.

0x01 is the only packet sent from the client and the client goes to an outdated server screen after 10 seconds.

I know 0x01 is also the LogjnPacket ID, but MCPE packets are wrapped in a batch packet (0xFE), and i dont receive one of those.

0x01: http://wiki.vg/Pocket_Edition_Protocol_Documentation#Unconnected_Ping

The wiki does not list 0x1c, but i was told by someone the pong is that

Well tbh i have no idea what im talking about. https://github.com/ProjectKatana/Katana.

lukeeey commented 7 years ago

My other problem is i dont know how to read or write bytes using RakNet :/

lukeeey commented 7 years ago

@StormxBlur I also get an outdated server message when my mcpe version protocol is 137

screenshot_2017-11-13-16-50-31 screenshot_2017-11-13-16-46-40

Kworz commented 7 years ago

are you launching your server and minecraft on the same device ?

lukeeey commented 7 years ago

Yes but that is never a problem with PMMP and it shouldnt be saying outdated server.

Kworz commented 7 years ago

Change your protocol number to 107 it will work

define MCPE_PROTOCOL "107"

MCPE tells you that the server is outdated if your protocol number is not the same as the server protocol number

lukeeey commented 7 years ago

You aren't looking at my screenshots. The client tells me the protocol is 137, so i set it to 137 on the server.

Kworz commented 7 years ago

I have the same protocol number (137) in my game and i still use 107 and it works. Protocol 137 that MCPE gives you is Internal raknet protocol Number.

lukeeey commented 7 years ago

I was told i need to change the Unconnected Pong ID from 0x02 to 0x1c in the RakNet source.

Kworz commented 7 years ago

Raknet manage natively Offlinepingresponse you have nothing to change at all.

lukeeey commented 7 years ago

I'm aware but still. I can't find where the ID_UNCONNECTED_PONG id is actually defined.

Kworz commented 7 years ago

There is something you dont understand, ID_UNCCONECTED_PONG is not handled like the other Raknet native packets. You are searching the problem not in the correct place. Your packet is sent successfully the only thing that is wrong is you MCPE_PROTOCOL that should be equal to 107.

screenshot_6

screenshot_7

lukeeey commented 7 years ago

Nope.

screenshot_2017-11-14-18-05-40 screenshot_2017-11-14-18-05-35 screenshot_2017-11-14-18-08-22

Kworz commented 7 years ago

haha mybad i thought u were having trouble to get the server displayed in the server list.

The unconnected ping / pong packets are for lan discovery not for the server connection. it changes nothing the connection system.

If MCPE tells you that server is outdated its simply because you havent added the client connection handling.

lukeeey commented 7 years ago

But the only packet i receive is the 0x01 ping packet wtf do i do to receive more packets

Kworz commented 7 years ago

For me when i just read packets, if i connect to my server i get 0x13 & 0xFE screenshot_8