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


Groups > comp.lang.python > #10936

Sockets: Receiving C Struct

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <Johnny.Venter@zoho.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'help?': 0.03; 'python': 0.08; 'array.': 0.09; 'content-type:multipart/signed': 0.09; 'struct': 0.09; 'sys,': 0.09; 'server,': 0.12; '153': 0.16; 'content-type:application/pgp-signature': 0.16; 'int.': 0.16; 'port))': 0.16; 'received:72.5': 0.16; 'received:72.5.230': 0.16; 'received:72.5.230.103': 0.16; 'received:sender1.zohomail.com': 0.16; 'received:zohomail.com': 0.16; 's.close()': 0.16; 'x-mailer:apple mail (2.1084)': 0.16; 'thanks,': 0.18; 'input': 0.24; 'host': 0.27; 'problem': 0.28; 'import': 0.28; 'print': 0.29; "skip:' 10": 0.30; 'it.': 0.33; 'to:addr:python-list': 0.33; 'someone': 0.34; 'test': 0.34; 'charset:us-ascii': 0.36; 'subject:: ': 0.39; 'received:192': 0.39; 'header:Mime-Version:1': 0.39; 'data': 0.39; 'to:addr:python.org': 0.39; 'setup': 0.40; 'where': 0.40; 'header:Message-Id:1': 0.61; 'johnny': 0.84
DomainKey-Signature a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=from:content-type:subject:date:message-id:to:mime-version; b=Bud5O2hm2WbrccRWKXV0NUF0CfPVOWYFGUKYj2JPMslNjLEEB8JpQcSaqZ6mCL0DyKE3hDOeBIEO WVRHpaN/NjbY4PwgZ6e+ohEEl87Bxo06Aus4W7Vw7pGRNhAgdfxS
From Johnny Venter <Johnny.Venter@zoho.com>
Content-Type multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-250--768095790"
Subject Sockets: Receiving C Struct
Date Fri, 5 Aug 2011 08:15:53 -0400
To python-list@python.org
Mime-Version 1.0 (Apple Message framework v1084)
Content-Transfer-Encoding 7bit
X-Pgp-Agent GPGMail 1.3.3
X-Mailer Apple Mail (2.1084)
X-Zoho-Virus-Status 1
X-ZohoMailClient External
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1949.1312581070.1164.python-list@python.org> (permalink)
Lines 101
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1312581070 news.xs4all.nl 23880 [2001:888:2000:d::a6]:39004
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:10936

Show key headers only | 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