[Stackless] Hello, and socket question

Richard Tew richard.m.tew at gmail.com
Wed Nov 15 13:31:24 CET 2006


On 11/15/06, Kuros <kurosknight at gmail.com> wrote:
> class Player(Entity, socket.stacklesssocket):
>     def __init__(self, clientSocket, clientAddress, name='',
> description=''):
>         Entity.__init__(self)
>         socket.stacklesssocket.__init__(self, clientSocket)
>         self.address = clientAddress

What you have here in clientSocket is not a raw Python socket,
but an instance of stacklesssocket.  So what you are doing
is passing a stacklesssocket down to socket.stacklesssocket
where a raw Python socket is expected.  Unsurprisingly this
does not work very well :-)

> class World(object):
> ...
>         print "Accepting connections on", host, port
>         try:
>             while listenSocket.accepting:
>                 clientSocket, clientAddress = listenSocket.accept()

clientSocket here was already wrapped with an instance of
stacklesssocket.  This was done in the dispatcher class in the
stackless socket module in the wrap_accept_socket function.

If I were you, I would not be subclassing the stacklesssocket
class, or any class from the socket module.

Hope this helps,
Richard.

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list