Many thanks for the help. I had hoped to be able to use Twisted's udp but it makes no real difference. Thanks Bruce
Like Carl suggested, I just eschewed Twisted on the client side when I did something similar. Here is a simple client that can be used with the server I sent earlier.
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) data = "Data from client" s.sendto(data, ('localhost', 8000)) data,address = s.recvfrom(1024) print "received %r from %r" % (data, address)
If you don't want the server to send anything back, you can skip the recvfrom() on the client side and the self.transport.write() on the server side. Of course, this doesn't include any error handling for when the UDP data doesn't actually make it (which, of course, isn't guaranteed) - but this is just to illustrate how simple it is.
-Black
On Jun 14, 2007, at 3:54 PM, Carl Zmola wrote:
If you are not receiving datagrams on the client side, is there any reason to use twisted for the client side? You could just pump datagrams out when you need to send something.
Bruce Coram wrote:
How do you send data using udp?
I want to use udp to send messages from clients to a server. I don't want to use connected udp.
Can anyone supply some specimen code for me
Thanks
Bruce Coram
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python