Sockets

Pekka Pessi Pekka.Pessi at nokia.com
Sat Jun 2 18:04:39 EDT 2001


In message <3B193770.30999EAC at telocity.com> Adonis <deltapigz at telocity.com> writes:
>how can i check for errors when using the socket module?
>errors like: unable to connect; insufficient memory etc.

        Usually, you get an exception indicating the error.  If you are
        using sockets in nonblocking mode, you can also check errors
        explicitly with getsockopt() method, e.g.,

                error = s.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)

        BR,
                                        Pekka Pessi



More information about the Python-list mailing list