Closed LoucIsZbib closed 7 years ago
oh, while we're at it, it would also be cool to be able to choose the interface/address on which the socket should be opened. Indeed on my test machine (debian linux), self.socket.bind((socket.gethostbyname(socket.gethostname()), 0))
opens a socket on 127.0.1.1:
cheers
it would also be cool to be able to choose the interface/address on which the socket should be opened
I agree. Probably it would be best to bind to '0.0.0.0' or '::'.
For comparison, on my machine, the routine returns my machine's assigned IP:
>>> socket.gethostbyname(socket.gethostname())
'192.168.99.99'
Putting these two requests together, the DCC listen should probably accept a bind_addr
parameter, which is the host pair (or quad) as passed to socket.bind.
So yes, I'd support a PR to address this need. Sorry for the long delay in responding.
Closing as languishing, but I welcome a pull request.
Hello, I'm using your irc lib from a while now and it is awsome, thanks for your work and sharing it !
I would like to be able to select the port for dcc_listen connection, I think the modification needed are the following ones :
In client.py
line 1046 : class DCCConnection: def listen(self): ==> def listen(self, PORT=0):
line 1061: self.socket.bind((socket.gethostbyname(socket.gethostname()), 0)) ==> self.socket.bind((socket.gethostbyname(socket.gethostname()), PORT))
line 1237: def dcc_listen(self, dcctype="chat"): ==> def dcc_listen(self, dcctype="chat", PORT=0):
line 1244: dcc.listen() ==> dcc.listen(PORT)
It would help me if you can integrate these modifications (which shouldn't have consequences for people using the actual version of irc module), so I can select port with dcc_listen(PORT) directly with module installed by "pip install irc"
Luc