I am connecting to a server and receiving the data, but I am new to python and networks so I have only been using recv(x bits) the issue is that it is not a constant number so we either receive too few or too much information.
import socket
import sys
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sa = ('ip.address', portnumber)
sock.connect(sa)
data = sock.recv()
print data
sock.close()
Is there a way to just receive the information without it looping? Or do you need to know the size beforehand? Thanks.