4

我正在用 Python 构建一个简单的 MinecraftClassic 机器人。现在我什至无法登录。到目前为止,这是我的代码:

import socket
s = socket.socket()
KEY = "serverkey"
HOST = "68.53.14.13"
PORT = 25566
s.connect((HOST, PORT))
print 'connected'
START_LOGIN = s.sendall(chr(0x00)) # Start login packet
PROTOCOL    = s.sendall(chr(0x07)) # Send protocol version
USERNAME    = s.sendall("Vik2015") # Username
VERKEY      = s.sendall(KEY)       # Verification key
UNUSED      = ""                   # Unused byte
print 'sentall'
print s.recv(4096)
s.close()

但是当我执行它时,我的客户就会永远坚持下去。它没有得到服务器的任何响应。我做错了什么?我真的很想写这个机器人。

4

1 回答 1

2

将评论放在一起,这就是你得到的:

import socket
s = socket.socket()
KEY = "ce73007bb263c20268da59eb9fb52b06" # If you want to help me, you can use this key to connect to the server
USERNAME = "Vik2015"
HOST = "68.53.14.13"
PORT = 25566
s.connect((HOST, PORT))
print 'connected'
# login packet (pkt id, protocol version, user name, verification key, pad)
s.sendall('%c%c%-64s%-64s%c' % (0, 7, USERNAME, KEY, 0))
print 'sentall'
print s.recv(4096)
s.close()
于 2013-11-01T21:12:21.407 回答