removed shared directory for clarity. changed setup.py

This commit is contained in:
troido 2017-10-30 12:05:09 +01:00
parent cb6ef661da
commit 843b37f9c6
2 changed files with 2 additions and 34 deletions

View File

@ -1,32 +0,0 @@
HEADER_SIZE = 4
# this module is for sending discree messages over TCP
# this is achieved by prefixing all messages with their length
# calls to send and recv will also keep attempting to send all data unless this proves impossible
def send(sock, msg):
length = len(msg)
header = length.to_bytes(4, byteorder="big")
totalmsg = header + msg
sock.sendall(totalmsg)
def receive(sock):
header = recvall(sock, 4) #sock.recv(4)
length = int.from_bytes(header, byteorder="big")
return recvall(sock, length)
def recvall(sock, length):
chunks = []
bytes_recd = 0
while bytes_recd < length:
chunk = sock.recv(min(length - bytes_recd, 4096))
if chunk == b'':
break
#raise RuntimeError("socket connection broken")
chunks.append(chunk)
bytes_recd = bytes_recd + len(chunk)
return b''.join(chunks)

View File

@ -15,8 +15,8 @@ setup(
],
entry_points={
'console_scripts': [
'asciifarm = asciifarm.client:main',
'hostfarms = asciifarm.server:main',
'asciifarm = asciifarm.client.main:main',
'hostfarms = asciifarm.server.main:main',
# TODO: troido, if you want just one asciifarm command, change
# this to asccifarm and remove the previous two lines -wangofett, 2017-10-27
'testasciifarm = asciifarm.__main__:main',