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


Groups > comp.lang.python > #45674

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

Date 2013-05-21 10:49 -0500
From Andrew Berg <bahamutzero8825@gmail.com>
Subject Re: How to raise a socket "104 connection reset by peer error"
References <b3a60c4b-9077-4f05-9269-64f5d899a2e7@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.1927.1369151376.3114.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

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

csiph-web