Error when executing the library reference echo server example

Jean-Paul Calderone exarkun at divmod.com
Mon Dec 10 07:48:28 EST 2007


On Mon, 10 Dec 2007 04:16:03 -0800 (PST), diego.martin.a at gmail.com wrote:
>Hi. Python newbie speaking,
>
>I've copy/pasted the example of the echo server that comes in the IDLE
>documentation ("Python Library Reference" section 17.2.3) to see how
>the sockets work. The only change I've made is in the host address
>which I've set to 'localhost' in the client. You can see the complete
>code below the message.
>
>When I run it I get the following error:
>     Traceback (most recent call last):
>          File "C:\Python25\eclient.py", line 11, in <module>
>          data = s.recv(1024)
>     error: (10053, 'Software caused connection abort')
>
>Is the example wrong? In this case, Where can I find a working
>example? Have I messed up the example putting 'localhost'? (don't
>think so, because I tried with '127.0.0.1' and I got the same error).
>And the big one, Why I get the error and how can I avoid it in future
>applications?
>
>Lot of thanks in advance!!

You're seeing the expected behavior.  The example doesn't take care to
handle any error conditions.  It has other bugs as well, such as not
checking the return value of socket.send().

Here's a different echo example:

  http://twistedmatrix.com/projects/core/documentation/examples/#auto0

Jean-Paul



More information about the Python-list mailing list