[Twisted-Python] help with deferreds??

john peter neuzhoundxx at yahoo.com
Thu Feb 2 16:43:17 EST 2006

hmmm... this was the trace output i got:
  conn1 connection made. requesting session establishment ...
conn2 connection made. requesting session establishment ...
conn1 Server said: '\x82\x00\x00\x00'
conn1 Positive Service Response Packet received!
conn1 connection lost
Connection lost - goodbye!
numPorts = 1
  looks like connection 2 never got a response from the server, connection 1 completed its work (i did not put it into a continuous loop), but connection 2 seems to be hanged.
  i'm running twist on windows XP.  any hypothesis regarding connection 2?

Jean-Paul Calderone <exarkun at divmod.com> wrote:
  On Thu, 2 Feb 2006 12:37:17 -0800 (PST), john peter wrote:
>i'm writing an app that makes two twisted client connections to the same server.
> After each connection is made, each client connection sends a session
> establishment request to the server (per Netbios over TCP/IP protocol ) in the
> Protocol.connectionMade() method. In the dataReceived method, I check if my
> request was successful. If not successful, I display a failure notice then call self.transport.loseConnection(). if successful, I flip an internal variable "sessionEstablished" to true, then the intention is for the successful connection
> to continually interact with the server in a loop. this means, however, that i would get
> into a send-receive data loop, which as i've observed, would prevent the other successful connection to get any work done..

This is not the case. When you wish to send data, you call write on a transport. When data is received, your protocol's dataReceived method will be invoked with it. These actions are fairly common in all Twisted programs. They work just fine.

> would it still be appropriate for me to use twisted for such application? if so, how should i approach the sendDataToServer() blocking. I'm read the docs on deferreds, but i'm still unsure how to proceed.

Why would sendDataToServer block? It should simply call write on a transport and then return.


Twisted-Python mailing list
Twisted-Python at twistedmatrix.com

 Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20060202/1e7fbf51/attachment.htm 

More information about the Twisted-Python mailing list