[Twisted-Python] twistedmatrix client

Itamar Shtull-Trauring twisted at itamarst.org
Sun Mar 3 18:30:14 EST 2002

Kelly Roestel wrote:
> I am new to python and twistedmatrix, so any help would be great.  I have 
> been able to write a server and connect to it via python sockets.  But I 
> would like to figure out how to create a twisted client.  But, I have 
> found no docs on creating clients.  Is there some place that I can look 
> for docs, or can some one help me with client setup.  What I am passing to 
> the client from the server is a simple list with four items.  Thanks for 
> the help

# here's an example of a client that connects to "foobar.com"
# on port 8023

from twisted.protocols import protocol
from twisted.internet import main, tcp

class MyProtocol(protocol.Protocol):

     def connectionMade(self):

     def dataReceived(self, data):
         print "server sent me data, yay!", data

p = MyProtocol()
tcp.Client("foobar.com", 8023, p)

# start the event loop

More information about the Twisted-Python mailing list