Actually reply to the client.
This commit is contained in:
parent
e8ef9a095f
commit
6db5d80e97
3 changed files with 9 additions and 6 deletions
|
@ -8,3 +8,4 @@ s.send(struct.pack(">b", 49))
|
|||
s.send(struct.pack(">h", 4) + "dupa".encode("utf-16le"))
|
||||
s.send(struct.pack(">h", 4) + "crap".encode("utf-16le"))
|
||||
s.send(struct.pack(">i", 25565))
|
||||
print " ".join("%02x" % ord(c) for c in s.recv(1024))
|
|
@ -80,12 +80,7 @@ int CClientConnection::Communicate(void)
|
|||
m_State = HANDSHAKE;
|
||||
m_InPacket = false;
|
||||
|
||||
utf8str Dupa = MakeUTF8("Dupa!");
|
||||
|
||||
TVector<unsigned char> OutBuffer = CGenericS2CPacket::Serialize(S2CKICK, &Dupa);
|
||||
for (unsigned int i = 0; i < OutBuffer.size(); i++)
|
||||
printf("%02X ", OutBuffer[i]);
|
||||
printf("\n");
|
||||
SendToClient(CGenericS2CPacket::Serialize(S2CKICK, &MakeUTF8("Bye!")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,4 +92,9 @@ CClientConnection::~CClientConnection(void)
|
|||
{
|
||||
// memory leak / todo: delete packet if necessary
|
||||
delete [] m_Buffer;
|
||||
}
|
||||
|
||||
void CClientConnection::SendToClient(TVector<unsigned char> Buffer)
|
||||
{
|
||||
send(m_Socket, &Buffer[0], Buffer.size(), 0);
|
||||
}
|
|
@ -23,6 +23,8 @@ namespace umcs {
|
|||
CGenericC2SPacket *m_CurrentPacket;
|
||||
bool m_InPacket;
|
||||
CClient *m_Client;
|
||||
|
||||
void SendToClient(TVector<unsigned char>Bufer);
|
||||
protected:
|
||||
TSocket m_Socket;
|
||||
EClientConnectionState m_State;
|
||||
|
|
Reference in a new issue