|
-
Apr 12th, 2012, 02:28 AM
#1
Thread Starter
New Member
TCP client
hi all
im having a bit of trouble here. I have a minecraft game server. I want to write a tcp client which will send a packet of data. it should then respond back with a string which should contain the server information i.e: motd(message of the day), max player capacity and current player count.
according to a documentation it says i need to send a packet with an id of: 0xFE
It also give an example in php, ruby and python. But i am having difficulty doing this in vb
Here is a snippet of the documentation
Server List Ping (0xFE)
Client to Server
To load server info in the multiplayer menu, the notchian client connects to each known server and sends an 0xFE.
In return, the server sends a kick (0xFF), with its string containing data (server description, number of users, number of slots), delimited by a UCS-2 '§' (0xA7).
Note that as this is the last packet you'll see, you can get away with just chopping off the first three bytes (the ident and the string length) and decoding the remainder as a UCS-2 string.
If the number of available slots sent is equal to or less than 0, the client should display it as "???".
Example server pinger:
https://gist.github.com/1209061 (Python)
https://gist.github.com/1235274 (PHP)
http://pastebin.com/q5zFPcXV (Ruby)
Packet ID
0xFE
do have a look at the examples. You can try pinging this server:
host name: vidhu.game-server.cc
Port: 25565
I have copied the php script. you can view it in action here:
http://vidhucraft.co.uk/bukkitping.php
thanks a lot,
Vidhu
-
May 9th, 2012, 12:12 PM
#2
Hyperactive Member
Re: TCP client
It seems you just need to send the hex value 0xFE to the server. Using the TCPClient class, you would get the NetworkStream object and write the value to it then read the response from the server.
Code:
...
Dim message As Byte() = Encoding.ASCII.GetBytes("0xFE")
networkStream.Write(message, 0, message.Length)
...
EDIT: I did try contacting your server, but it refused the connection. Perhaps there are some configuration steps that still need to be taken?
Last edited by wakawaka; May 9th, 2012 at 12:23 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|