473,396 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Twisted and connected UDP example

At this page
--> http://twistedmatrix.com/documents/current/howto/udp
is an example that shows how connected UDP is done
with Twisted. I can't get it to work.
When I run it, it says:

....
self.startProtocol()
File "./client2.py", line 10, in startProtocol
d.addCallback(self._cbConnected)
AttributeError: 'NoneType' object has no attribute 'addCallback'
....

I.e it looks like the
"d = self.transport.connect("ip_to_listening_server", listen_port_nbr)"
doesn't return anything?

As server at "the other side" I've used the first example
and I have also tried using netcat as an listening UDP-server.
I'm sure that the IP-adress and port is correct in my code,
so it can't be that.

(Btw, the self.transport.write .. line is not correct indented
I suppose?)

Anyone that can help me with this?
Jul 18 '05 #1
1 4764
Joakim Bech <jy*@telia.com> writes:
At this page
--> http://twistedmatrix.com/documents/current/howto/udp
is an example that shows how connected UDP is done
with Twisted. I can't get it to work.
When I run it, it says:

...
self.startProtocol()
File "./client2.py", line 10, in startProtocol
d.addCallback(self._cbConnected)
AttributeError: 'NoneType' object has no attribute 'addCallback'
...

I.e it looks like the
"d = self.transport.connect("ip_to_listening_server", listen_port_nbr)"
doesn't return anything?


Right - it looks like the example is out of date. The connect()
method on the UDP transport did previously return a deferred because
it depended on an underlying socket connect, but was later revised
(looks like in March, 2004 from the svn logs) at which point it was no
longer a deferrable operation. I'm guessing the example wasn't
updated to match (you may want to file a defect on the twisted site
against it).

The UDP stuff in Twisted has remained labeled unstable for as long as
I've been working with Twisted. This particular connect() method is
fairly recent (it wasn't in Twisted 1.1.0 for example), although there
was an alternate connected UDP transport or something in earlier releases.

I'd suggest just taking out the callback - as currently implemented,
the call to connect() will complete synchronously and will have
established the target address as the target for subsequent
communication.

-- David
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Paul Moore | last post by:
I hit a problem yesterday with my mail connection. In a desparate attempt to understand what was going on, I wanted to log the connection traffic. After a bit of searching, I found a post on c.l.p...
1
by: Diez B. Roggisch | last post by:
Hi, I have a simple client-server app, that sits on a serial port and communicates through that with an attached microcontroller-board. To the outside, it exposes two sockets (file or inet)...
2
by: Qp | last post by:
Hello. I'm building a simple chat server and client interface, and I've got everything working except for this: While the client's basic.LineReceiver protocol class can sendLine when a...
2
by: Taki Jeden | last post by:
Hi Anybody used wxPython with twisted? I started putting together a Twisted-based app with wx GUI, and the widgets just don't work - some controls do not show up etc. - at least on my system....
2
by: SeSe | last post by:
Hi, I am new to Twisted. I use a Twisted 1.3.0 on MS Windows XP Home Edition, my python version is 2.3 I try the TCP echoserv.py and echoclient.py example. But the client always fail with...
1
by: qwejohn | last post by:
Hello, I had posted this question in the twisted mailing list but did not got a solution ; I hope that the python Gurus of this forum can help me a bit. I am trying the exmaple in the python...
2
by: Christopher Subich | last post by:
I'm building an application that makes several user-specified internet connections; twisted meets my needs more or less perfectly. I'm running into a problem, however, in that twisted is not...
9
by: Chris | last post by:
Does anyone know how to use twisted and tkinter. I have a simple tcp server and I want to send messages to it once connected using a tkinter button? I have built the code as far as I can but...
1
by: sndive | last post by:
i have a lot of trouble selling twisted a a client lib for network access (on embedded platform) the group i'm a member of wants to write some unmaintainable threaded blocking junk in c--. does...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.