Add some client logic, status to function state

This commit is contained in:
Ammar Askar committed 2014-11-10 20:25:30 +05:00
1 parent 1982716f73
commit f68206140b
4 files changed
+16 -12

No files matched your search

+6 -3
View File
@@ -5,7 +5,7 @@ These definitions and methods are used by the packet definitions
import struct
class Type:
class Type(object):
@staticmethod
def read(file_object):
pass
@@ -73,7 +73,10 @@ class VarInt(Type):
def read_socket(s):
d = 0
for i in range(5):
b = ord(s.recv(1))
b = s.recv(1)
if b == "":
raise RuntimeError("Socket disconnected")
b = ord(b)
d |= (b & 0x7F) << 7 * i
if not b & 0x80:
break
@@ -117,7 +120,7 @@ class Float(Type):
return struct.unpack('>f', file_object.read(4))[0]
@staticmethod
def send(svalue, socket):
def send(value, socket):
socket.send(struct.pack('>f', value))