Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #10936 > unrolled thread

Sockets: Receiving C Struct

Started byJohnny Venter <Johnny.Venter@zoho.com>
First post2011-08-05 08:15 -0400
Last post2011-08-05 08:15 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Sockets: Receiving C Struct Johnny Venter <Johnny.Venter@zoho.com> - 2011-08-05 08:15 -0400

#10936 — Sockets: Receiving C Struct

FromJohnny Venter <Johnny.Venter@zoho.com>
Date2011-08-05 08:15 -0400
SubjectSockets: 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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web