[Twisted-Python] help with deferreds??

john peter neuzhoundxx at yahoo.com
Tue Feb 7 09:59:54 EST 2006


This client code is making connections to a legacy app.  I do have Java code that simulates what the server side essentially does and this client code does seem to
  work as expected when run against that server code:
   
  commandline=python dd.py localhost 140 W04FSRV W04PS01 2
   
  buildProtocol with myName= W04PS01 instanceName= conn1
  conn1 connection made. requesting session establishment ...
myName= W04PS01   remoteName= W04FSRV
  buildProtocol with myName= W04BS03 instanceName= conn2
  conn2 connection made. requesting session establishment ...
myName= W04BS03   remoteName= W04FSRV
  conn1 Server said: '\x82\x00\x00\x00'
conn1 Positive Service Response Packet received!
conn1 TRANS CODE= 998
  conn1 sending server data ...
conn1 finished sending server data
conn1 connection lost
conn1 Connection lost - goodbye!
conn2 Server said: '\x82\x00\x00\x00'
conn2 Positive Service Response Packet received!
conn2 TRANS CODE= 998
  conn2 sending server data ...
conn2 finished sending server data
conn2 connection lost
conn2 Connection lost - goodbye!

  -------------------------------------------------------------------
  When run against the legacy app on <ip address>, only one connection seems to be 
  working (see output below).  Also, when I run the code one connection at a time, 
  the code works.
   
  Any suggestion what I can do on the client side to help me debug?
  I noticed there's log.msg()'s in the twisted code.  Would they have printed out
  on the dos console (i'm using windows xp as the client machine) if they had
  occurred?
   
  Also, one difference between the two "invocations" (connecting to java server code vs connecting to legacy app) is the port. For connecting to the java server code on localhost, the "remote" port is 140; for connecting  to the legacy app, the remote port
  is the usual NBT port 139. i don't think this should matter; just thought i'd mention it...
   
  commandline= python dd.py <ip address> 139 W04FSRV W04PS01 2

  buildProtocol with myName= W04PS01 instanceName= conn1
  conn1 connection made. requesting session establishment ...
myName= W04PS01   remoteName= W04FSRV
  buildProtocol with myName= W04BS03 instanceName= conn2
  conn2 connection made. requesting session establishment ...
myName= W04BS03   remoteName= W04FSRV
  conn2 Server said: '\x82\x00\x00\x00'
conn2 Positive Service Response Packet received!
conn2 TRANS CODE= 998
  conn2 sending server data ...
conn2 finished sending server data
conn2 connection lost
conn2 Connection lost - goodbye!

  glyph at divmod.com wrote:
  
On Fri, 3 Feb 2006 07:42:27 -0800 (PST), john peter wrote:

> With my initial attempt using Twisted, only one connection seems to succeed, and the other basically hangs.

This isn't quite a "minimal" example, since I don't have access to the server side that this code is expecting to talk to. Have you tried setting up a simpler server which does a listenTCP and then a server which does connectTCP to it multiple times? Does that work?

One thing that occurs to me is that if the first byte of the connection is not \x82 it will be disconnected immediately; the dataReceived you've written doesn't actually parse any protocol data. Depending on which prints are actually commented out or not that might look like hanging :)

_______________________________________________
Twisted-Python mailing list
Twisted-Python at twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
  


			
---------------------------------
 Yahoo! Mail - Helps protect you from nasty viruses.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20060207/9e4c57ea/attachment.htm 


More information about the Twisted-Python mailing list