[Twisted-Python] How to listen on and connect from same TCP port with Twisted?
Alvin Delagon
adelagon at gmail.com
Fri Jan 9 09:01:13 EST 2009
You shouldn't bind your client on a port where your server is listening to.
---
Alvin
On Fri, Jan 9, 2009 at 9:23 PM, Alessio Pace <alessio.pace at gmail.com> wrote:
> Hi,
>
> I would lilke tro listen on a given TCP port and initiate multiple TCP
> client connections from the same port, but I'm encountering the classical:
>
> <class 'twisted.internet.error.ConnectBindError'>: Couldn't bind: 98:
> Address already in use
>
> My code is:
>
> ######################################
>
> factory = Factory()
> # an almost empy subclass of Protocol
> factory.protocol = TCPServer
>
> reactor.listenTCP(12345, factory)
>
> # ClientFactory subclass which simply instantiate a TCPClient Protocol
> client_factory = TCPClientFactory()
>
> # last tuple is the bindAdress parameter
> reactor.connectTCP(target_addr, 12345, client_factory, 30,
> (source_addr, 12345))
>
> #######################################
>
> I've tried to look on the Internet and in the source code but I've not
> found a proper solution.
>
> Thanks in advance for any suggestion.
> Alessio Pace.
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
--
http://www.alvinatorsplayground.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20090109/1c56507c/attachment.htm
More information about the Twisted-Python
mailing list