Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Python recv loop

Reply
Thread Tools

Re: Python recv loop

 
 
Ihsan Junaidi Ibrahim
Guest
Posts: n/a
 
      02-11-2013
Hi MRAB,

My code now works thanks to your advice.

{"msgver": "1.0", "msgid": "200", "subcode": "100", "appver": "1.0", "appid": "1.0", "data": {"1": "igb0", "2": "igb1", "ifcnt": "2"}}
connected to misty:8080
sending data
138 bytes sent: 0x86{"msgver": "1.0", "msgid": "200", "subcode": "100", "appver": "1.0", "appid": "1.0", "data": {"1": "igb0", "2": "igb1", "ifcnt": "2"}}
receiving data
message length is 188
188 bytes received: { "msgver": 1.000000, "appver": 1.000000, "appid": 1000, "msgid": 10, "subcode": 20, "data": [ "110.159.183.16", "124.108.16.94", "2400:3700:50::2", "2400:3700:50::1", "2400:3700:51::" ] }

Many thanks.

On Feb 11, 2013, at 9:55 AM, MRAB <(E-Mail Removed)> wrote:

> You should keep reading until you get all need or the connection is
> closed:
>
> buf = b''
> while len(buf) < nbuf:
> chunk = sock.recv(nbuf - len(buf))
>
> if not chunk:
> break
>
> buf += chunk
>
> --
> http://mail.python.org/mailman/listinfo/python-list


 
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
Triple nested loop python (While loop insde of for loop inside ofwhile loop) Isaac Won Python 9 03-04-2013 10:08 AM
Python recv loop Ihsan Junaidi Ibrahim Python 7 02-12-2013 03:09 AM
Re: Python recv loop MRAB Python 0 02-11-2013 01:55 AM
Re: Python recv loop Dave Angel Python 0 02-11-2013 01:22 AM
How to empty the recv buffer without recv() ? deepak nayak C++ 3 10-25-2007 08:14 AM



Advertisments