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


Groups > comp.lang.python > #10936

Sockets: Receiving C Struct

From Johnny Venter <Johnny.Venter@zoho.com>
Subject Sockets: Receiving C Struct
Date 2011-08-05 08:15 -0400
Newsgroups comp.lang.python
Message-ID <mailman.1949.1312581070.1164.python-list@python.org> (permalink)

Show all headers | View raw


[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 comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web