Sockets: Receiving C Struct
Johnny Venter
Johnny.Venter at zoho.com
Fri Aug 5 08:15:53 EDT 2011
New to python and would like to test network/sockets with it.
I am having a problem where I have setup the following:
import socket, sys, struct
HOST = '1.1.1.1'
PORT = 153
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
data = struct.unpack('!I',s.recv(4))[0]
s.close()
print data
What I would like to do is take the input from the server, and store it in an array. The type of data is int.
Can someone help?
Thanks, Johnny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110805/28b44187/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 841 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/python-list/attachments/20110805/28b44187/attachment.sig>
More information about the Python-list
mailing list