no buffer space available error

sebastien s.thuriez at laposte.net
Sat May 18 05:20:17 EDT 2002


Hi,

This is the traceback (I scanned only 5 IP adresses) :

-------------------------------------------------

PythonWin 2.1.1 (#20, Jul 26 2001, 11:38:51) [MSC 32 bit (Intel)] on
win32.
Portions Copyright 1994-2001 Mark Hammond (MarkH at ActiveState.com) -
see 'Help/About PythonWin' for further copyright information.
>>> question_ftp_threaded :  number thread > max thread :sleeping
connect :  192.168.15.1
connect :  192.168.15.2
trying to shutdown :  192.168.15.2
Unhandled exception in thread:
Traceback (most recent call last):
  File "C:\Python21\simple_QUESTION_FTP_THREADED10.PY", line 36, in
control
    s.shutdown(2)
  File "<string>", line 1, in shutdown
socket.error: (10057, 'Socket is not connected')
trying to shutdown :  192.168.15.1
Unhandled exception in thread:
Traceback (most recent call last):
  File "C:\Python21\simple_QUESTION_FTP_THREADED10.PY", line 36, in
control
    s.shutdown(2)
  File "<string>", line 1, in shutdown
socket.error: (10057, 'Socket is not connected')
[]
[('192.168.15.2', 'The socket operation could not complete without
blocking'), ('192.168.15.1', 'The socket operation could not complete
without blocking')]
connect :  192.168.15.3
trying to shutdown :  192.168.15.3
Unhandled exception in thread:
Traceback (most recent call last):
  File "C:\Python21\simple_QUESTION_FTP_THREADED10.PY", line 36, in
control
    s.shutdown(2)
  File "<string>", line 1, in shutdown
socket.error: (10057, 'Socket is not connected')
connect :  192.168.15.4
trying to shutdown :  192.168.15.4
Unhandled exception in thread:
Traceback (most recent call last):
  File "C:\Python21\simple_QUESTION_FTP_THREADED10.PY", line 36, in
control
    s.shutdown(2)
  File "<string>", line 1, in shutdown
socket.error: (10057, 'Socket is not connected')
fin

-------------------------------------------------

the code is the same that on the previous examples except :


def control(hostname):

    reponse='non'
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.setblocking(0)
    socket_active.append(hostname)

    print "connect : ",hostname
    try :
        s.connect((hostname,21))
    except socket.error, why :
        debug.append((hostname,why[1]))
        if why[1] <> "The socket operation could not complete without
blocking":
            print 'cannot connect...',hostname, "why = ",why[1]
            
    print "trying to shutdown : ",hostname
    s.shutdown(2)
    #s.shutdown(0) or s.shutdown(1) error10057  socket is not
connected

   
    try :
        s.close()
        socket_active.remove(hostname)
        print "nb socket ",len(socket_active)
    except :
        not_closed.append(hostname)
        print "not closed ",not_closed
        print "problemes de s.close"
            
    return reponse


if I do a netstat I can see some of the socket (but it is real slow
...) they are in stats syn_sent.

?? I do not understand why the shutdown is not operating properly ??
Is there another way to kill the socket ??

Regards.

Sebastien.



Peter Hansen <peter at engcorp.com> wrote in message news:<3CE58CB2.365FCDD0 at engcorp.com>...
> sebastien wrote:
> > 
> > Is there a way in python to have the same information as in netstat. I
> > could call netstat but it is a little bit slow.
> 
> Don't think so.  That's a lower level OS issue.  Maybe some of the
> win32 stuff can do it.
> 
> > The shutdown method : s.shutdown(2) for example
> > does not work with my socket. Is it ok to use it with non blocking
> > socket ?
> 
> What does "not work" mean?  I suggest posting an exception traceback,
> preferably with a tiny snippet from an interactive prompt session
> showing a subset of your code failing.
> 
> I don't think it cares about non-blocking sockets, though I could
> be wrong, but I know it doesn't work with server sockets (i.e. the
> ones that are listening, not the sockets for each client connection
> that is accepted).
> 
> We're past the edge of my expertise and knowledge here... sorry.
> 
> -Peter



More information about the Python-list mailing list