Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #10936 > unrolled thread
| Started by | Johnny Venter <Johnny.Venter@zoho.com> |
|---|---|
| First post | 2011-08-05 08:15 -0400 |
| Last post | 2011-08-05 08:15 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
Sockets: Receiving C Struct Johnny Venter <Johnny.Venter@zoho.com> - 2011-08-05 08:15 -0400
| From | Johnny Venter <Johnny.Venter@zoho.com> |
|---|---|
| Date | 2011-08-05 08:15 -0400 |
| Subject | Sockets: Receiving C Struct |
| Message-ID | <mailman.1949.1312581070.1164.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
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
Back to top | Article view | comp.lang.python
csiph-web