Sockets

Pekka Pessi Pekka.Pessi at nokia.com
Sun Jun 3 00:04:39 CEST 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