Z
Zsdfhdfgasdf Gsfgsdgsdgsd
I'm making a TCP server in Ruby, and I still haven't figured out how I
can send packets the way it should be sent. I know how to receive
packets and such though...
For example, one of the packets I need to send looks like this:
Packet ID: 0x00
Purpose: Server Identification: Response to a joining player. The user
type indicates whether a player is an operator (0x64) or not (0x00.)
Current protocol version is 0x07.
Fields:
Packet ID Byte
Protocol Version Byte
Server name String
Server MOTD String
User Type Byte
The code I'm using for the server looks like this:
inform "Starting server"
server = TCPServer.new('127.0.0.1', config['port'])
--------------------
while true #Runs all the time, or until user chooses to quit.
Thread.start(server.accept) do |client|
data = client.recv(1024)
data = data.split(" ")
inform "Recieved Player identification from #{data[0]}"
client.write "#{config['name']} #{config['motd']}"
sleep 60
end
end
--------------------
While it outputs "<Thu Jul 15 18:16:18 +0200 2010> Recieved Player
identification from "(name)"
The client side says that it's been disconnected.
I believe it's because I'm sending data wrong. May someone correct me or
give me pointers?
can send packets the way it should be sent. I know how to receive
packets and such though...
For example, one of the packets I need to send looks like this:
Packet ID: 0x00
Purpose: Server Identification: Response to a joining player. The user
type indicates whether a player is an operator (0x64) or not (0x00.)
Current protocol version is 0x07.
Fields:
Packet ID Byte
Protocol Version Byte
Server name String
Server MOTD String
User Type Byte
The code I'm using for the server looks like this:
inform "Starting server"
server = TCPServer.new('127.0.0.1', config['port'])
--------------------
while true #Runs all the time, or until user chooses to quit.
Thread.start(server.accept) do |client|
data = client.recv(1024)
data = data.split(" ")
inform "Recieved Player identification from #{data[0]}"
client.write "#{config['name']} #{config['motd']}"
sleep 60
end
end
--------------------
While it outputs "<Thu Jul 15 18:16:18 +0200 2010> Recieved Player
identification from "(name)"
The client side says that it's been disconnected.
I believe it's because I'm sending data wrong. May someone correct me or
give me pointers?