Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50246
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!storethat.news.telefonica.de!telefonica.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: How to clean up socket connection to printer |
| Date | Tue, 09 Jul 2013 16:05:08 +0200 |
| Lines | 45 |
| Message-ID | <lthtaa-u52.ln1@satorlaser.homedns.org> (permalink) |
| References | <c124b305-e2de-4355-bd20-15d0f9a40b65@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de ygfU7geFaZyElGJNf4HGFALzhTrPg4e+0d9QbV/pBI3A== |
| X-Orig-Path | satorlaser.homedns.org!not-for-mail |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 |
| In-Reply-To | <c124b305-e2de-4355-bd20-15d0f9a40b65@googlegroups.com> |
| Xref | csiph.com comp.lang.python:50246 |
Show key headers only | View raw
Am 09.07.2013 11:39, schrieb loial: > I have a socket application that is connecting to a HP printer via port 9100. > > Occassionally I get a "Connection reset by peer" error which I am > trapping and exiting the script with an error message. Strange. Why does the remote terminate the connection? > That works Ok, the issue I have is that the next time I run the > script I get "Connection refused" from the printer, which > suggests that the printer still thinks the port is is busy, > though nothing is printing. I suspect that in some way my socket > connection has not been closed correctly? I'm assuming you are using TCP. Getting a "connection refused" rather means that there is no server process that is listening on that port. It sounds a bit as if the printer was kind-of rebooting itself, which first resets the existing connection and then, after a rebooting, opens the port again for connections. Question here: 1. Does the printer accept connections again after some time? 2. Does the printer accept connections if you close and re-open the Python interpreter? 3. Is there actually a limit to the number of concurrent connections? In other words, what happens when you try to create a second connection without closing the first? > When I get the "Connection rest by peer" error, I attempt to close > the port as follows : [...] This is useless, the connection is already closed at that point. Your description suggests that it is a remote problem. I still wouldn't rule out that it is somehow caused by your code though, but without seeing that, it's impossible to tell. Good luck! Uli
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to clean up socket connection to printer loial <jldunn2000@gmail.com> - 2013-07-09 02:39 -0700
Re: How to clean up socket connection to printer Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-07-09 16:05 +0200
Re: How to clean up socket connection to printer loial <jldunn2000@gmail.com> - 2013-07-11 02:28 -0700
Re: How to clean up socket connection to printer Chris Angelico <rosuav@gmail.com> - 2013-07-11 20:13 +1000
Re: How to clean up socket connection to printer loial <jldunn2000@gmail.com> - 2013-07-15 04:22 -0700
csiph-web