Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
can not get lost connection msg?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
sleepd  
View profile  
 More options Apr 27 2012, 3:49 am
From: sleepd <slee...@gmail.com>
Date: Fri, 27 Apr 2012 15:49:55 +0800
Local: Fri, Apr 27 2012 3:49 am
Subject: can not get lost connection msg?

hi, I am trying to write a server by gevent, and I found that sometimes my
server can not got the connection lost signal when client close the
connection. this is my code and anyone can help me find out where is the
problem?

server runs on Linux, but develop on windows.

def _listener(self, sock):
        while True:
            # gevent will raise a error when connection lost at windows, so
use "try"
            try:
                data = sock.recv(1024)
            except socket.error, e:
                break
            if not data:
                break
        self._localServer.lostConnect(self)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Executier Godlike  
View profile  
 More options Apr 27 2012, 12:11 pm
From: Executier Godlike <s...@messir.net>
Date: Fri, 27 Apr 2012 18:11:57 +0200
Local: Fri, Apr 27 2012 12:11 pm
Subject: Re: [gevent] can not get lost connection msg?
May be in this moment recv() returns empty data?
It's the usual approach for socket to indicate closed connections.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
cat street  
View profile  
 More options Apr 27 2012, 9:04 pm
From: cat street <gam...@gmail.com>
Date: Sat, 28 Apr 2012 09:04:24 +0800
Local: Fri, Apr 27 2012 9:04 pm
Subject: Re: [gevent] can not get lost connection msg?

Maybe like this:

    while True:
        try:
            data = sock.recv(1024)
            if not data: break
        except socket.error:
            break

2012/4/27 sleepd <slee...@gmail.com>:

--
HomePage: cat.appspot.com

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
徐乔  
View profile  
 More options Apr 27 2012, 9:47 pm
From: 徐乔 <slee...@gmail.com>
Date: Sat, 28 Apr 2012 09:47:55 +0800
Local: Fri, Apr 27 2012 9:47 pm
Subject: Re: [gevent] can not get lost connection msg?

i removed the try and still problem

发自我的 iPhone

在 2012-4-28,9:04,cat street <gam...@gmail.com> 写道:

Maybe like this:

    while True:
        try:
            data = sock.recv(1024)
            if not data: break
        except socket.error:
            break

2012/4/27 sleepd <slee...@gmail.com>:

--
HomePage: cat.appspot.com

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »