Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76923
| From | dieter <dieter@handshake.de> |
|---|---|
| Subject | Re: socket issue with recv() |
| Date | 2014-08-24 07:59 +0200 |
| References | <64392c10-28c5-4eee-93d2-7dd4edba56fe@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13372.1408859988.18130.python-list@python.org> (permalink) |
Arthur Clarck <aclarck5@gmail.com> writes: > ... > The problem I have now is the following. > I have a script to connect to some telecom service. > The script is forking (parent/child) > The child is only reading what comes from the remote server. > Here the problematic code: > > total = '' > while True: > data = s.recv(1024) > total += data > if (data == ''): > print 'remote site is closed' > s.close() > sys.exit() > > What is happening is that I got some datas from the remote site, > Something like 'Contacting BH: ...' > But directly followed by 'remote site is closed. Some services (such as older HTTP 1.0 services) are designed for "one command per connection" mode. This means, they answer a signle command and then close the connection. >From what you describe, your service might belong to this class. In this case, you would need to open a new connection whenever you detect that the old connection was closed.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
socket issue with recv() Arthur Clarck <aclarck5@gmail.com> - 2014-08-23 01:23 -0700 Re: socket issue with recv() Arthur Clarck <aclarck5@gmail.com> - 2014-08-23 01:39 -0700 Re: socket issue with recv() Marko Rauhamaa <marko@pacujo.net> - 2014-08-23 11:46 +0300 Re: socket issue with recv() dieter <dieter@handshake.de> - 2014-08-24 07:59 +0200
csiph-web