Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Fwd: Sockets: Receiving C Struct

Reply
Thread Tools

Fwd: Sockets: Receiving C Struct

 
 
Johnny Venter
Guest
Posts: n/a
 
      08-05-2011
I was not sure if this message was sent before my membership was accepted.

Please disregard if it's a duplicate.

Thanks

Begin forwarded message:

> From: Johnny Venter <(E-Mail Removed)>
> Date: August 5, 2011 8:15:53 AM EDT
> To: http://www.velocityreviews.com/forums/(E-Mail Removed)
> Subject: Sockets: Receiving C Struct
>
> 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
>



-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)

iQIcBAEBAgAGBQJOO+qaAAoJEBRo55dgl7RwZe8P/3L+gkdcxg+BCl2fXflFf1pj
S25kG7PGoW7mINzt6g2I9jbzxHQ/IEf1IdV7D7NNjowjQGN60NI7d+3kdfuArW43
WNgd5f6JzZiz52TK71oYjjzlME8r22EBek1IKNoLqowEJvsC4B XbyKgZrS44rJP2
lt8hwNzxQVkhKSYJTmHx/qkKeeErLgofiqOBUlnqKXk0UKtyqUs5+cyVo4ysD6NF
TxWmfieCc58JVhVevK0YEnJyLxZEU8br6dJdnnRcZZGBJ5dItr x2uEnJumUPpuVG
Ymnvf52v8oNjNlIgtpspXA88Elfi9x3f0Fq5ynvQfI8tI3jOof bX2q9EyWb8tcrM
y6RRwxIBoUhHKMZ/oaocrqBZrg+0LPb/OzQLTcVApV9QLLKMXPugg5aFenYnriZD
bZLXuL+L/0DF4F8wRCA+H2AcNg0BdwvXqmPP/C6P8nrAJsx3EGl3Q5F7rsZVrsfW
g+2msW/mB9a81LLYpN9Kf2TXUn9quVk2NhPvRUSCylkfiL/sqDc5nvRa+94TKCwv
VEEUm48fnVvJ6JzAFwi1AT6WpSuUngZS6h2fOyIqToDGTMSjue NeL0xqmR5YY0hs
3wc5DO0b07OdRalICRwIh3UuQjNMvVi28slxIalt4iqboLIyEU QCeEPczZrl16L/
X/LiJhfafOVe5y8rWj9l
=DOVp
-----END PGP SIGNATURE-----

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can *common* struct-members of 2 different struct-types, that are thesame for the first common members, be accessed via pointer cast to either struct-type? John Reye C Programming 28 05-08-2012 12:24 AM
Sockets: Receiving C Struct Johnny Venter Python 0 08-05-2011 12:15 PM
struct in struct Gunnar G C++ 14 06-02-2004 06:43 PM
struct my_struct *p = (struct my_struct *)malloc(sizeof(struct my_struct)); Chris Fogelklou C Programming 36 04-20-2004 08:27 AM
implementing a templated struct within a templated struct RA Scheltema C++ 3 01-06-2004 11:25 AM



Advertisments