Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #45670 > unrolled thread

How to raise a socket "104 connection reset by peer error"

Started byloial <jldunn2000@gmail.com>
First post2013-05-21 08:26 -0700
Last post2013-05-21 10:49 -0500
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  How to raise a socket "104 connection reset by peer error" loial <jldunn2000@gmail.com> - 2013-05-21 08:26 -0700
    Re: How to raise a socket "104 connection reset by peer error" Andrew Berg <bahamutzero8825@gmail.com> - 2013-05-21 10:49 -0500

#45670 — How to raise a socket "104 connection reset by peer error"

Fromloial <jldunn2000@gmail.com>
Date2013-05-21 08:26 -0700
SubjectHow to raise a socket "104 connection reset by peer error"
Message-ID<b3a60c4b-9077-4f05-9269-64f5d899a2e7@googlegroups.com>
For testing purposes I want my code to raise a socket "connection reset by peer" error, so that I can test how I handle it, but I am not sure how to raise the error.

Any advice appreciated

  

[toc] | [next] | [standalone]


#45674

FromAndrew Berg <bahamutzero8825@gmail.com>
Date2013-05-21 10:49 -0500
Message-ID<mailman.1927.1369151376.3114.python-list@python.org>
In reply to#45670
On 2013.05.21 10:26, loial wrote:
> For testing purposes I want my code to raise a socket "connection reset by peer" error, so that I can test how I handle it, but I am not sure how to raise the error.
Arbitrary exceptions can be raised with the raise keyword. In Python 3.3, that exact error got its own builtin exception:
http://docs.python.org/3.3/tutorial/errors.html#raising-exceptions
http://docs.python.org/3.3/library/exceptions.html#ConnectionResetError

In earlier versions of Python, you will have to raise OSError and set its errno attribute.

-- 
CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web