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: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-250--768095790 Content-Type: multipart/alternative; boundary=Apple-Mail-249--768095907 --Apple-Mail-249--768095907 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 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 =3D '1.1.1.1' PORT =3D 153 s =3D socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) data =3D 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 --Apple-Mail-249--768095907 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii 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 =3D = '1.1.1.1'
PORT =3D 153
s =3D = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, = PORT))

data =3D = 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

= --Apple-Mail-249--768095907-- --Apple-Mail-250--768095790 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) iQIcBAEBAgAGBQJOO975AAoJEBRo55dgl7RwAYoQAMX7Svf3DK4NTV+2RWw1r3Rs UZLQK6helvmz+ld3oKI9RUDAmmUjrALHK6cGqGJYk+vyu9l4PM7xRRsEI6JA37XM tzACZlqTUS1r8mtQglFyZt0ZVvzXy2z5rsQtct5+xWuLDj54UJ+rzvXhqGEEdj15 OuHNkoPxardna6e4eF/yzF9n5gIlCcXde4l7qJJTPWYUH1h1mXc2D1jHW1SvZvcS wTn5tw+Kj5OLFjkIjWFetX4YjmZ285/jtvY1GLX9zq9dd9GwYN1f1/QRDfAk/hjO sglS8HJy1In6ohYp//Mh2ALQYMTDpZrWzlhMUasDO1rfdJCeUINbnmw/ervX428w wlr4rBaXL8d5d++NDz0Vg7J80U5CpxsqJYst78iYfn56tS1CvHuJ3FuFdlD8dEQh WmzgcCjU2Pc7xZaHYlZiNw8YEliKwNwYv7+XL0GSQIxTdf/j9lyOeJevn1xpGQy/ 9XUO3ojXeRB+3omZ9ESpSjIFxkgUcwtrJBwEemYUZzxO77W4ZmXRpwHgXU2kCOEB 2UIv44QcpVrksHsLYus8Vu343ADBOyXOC17yNEsv6fRGs8Bc8k7rwT/sxxX13lPf 4gwD92esiQNY/GKf97wJLKlwTHaodRQW1ByzPCmwAteaBkLa2xC7DJfCRyWmU3HI zYnN4+pWaJSvvHdvoZGp =1H0X -----END PGP SIGNATURE----- --Apple-Mail-250--768095790--