samedi 1 novembre 2014

Python UDP-Receive buffer being overwritten


Vote count:

0




I have a client(written in Python) and a server(writted in C)


Here is part of my code for python udp client:



for x in range(noResults):
fName, addr = sock.recvfrom(1000)
print "Name:", fName
resultList[x].name=fName.strip('\x00')
fSize, addr = sock.recvfrom(1000)
print "Size:", fSize
resultList[x].size=fSize.strip('\x00')
fPort, addr = sock.recvfrom(1000)
print "Port:", fPort
resultList[x].port=fPort.strip('\x00')
fIP, addr = sock.recvfrom(1000)
print "IP:", fIP
resultList[x].ip=fIP.strip('\x00')
sys.stdout.flush()
print "IP:",resultList[x].ip
i=i+1


while the output it produces after communicating with server(written in C) is:


Name: travel Prague.mp4

Size: 1936l Prague.mp4

Port: 5008l Prague.mp4

IP: 127.0.0.1gue.mp4

IP: 127.0.0.1gue.mp4


How can i solve this problem?



asked 47 secs ago







Python UDP-Receive buffer being overwritten

Aucun commentaire:

Enregistrer un commentaire