Skip Menu |
Report information
Id: 131766
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: alex.jakimenko [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Specifying the source address of an outgoing connection using IO::Socket::*
It should be possible to specify the source address of outgoing (client) connections. This is especially useful if the machine has more than one IP address. Examples in other software: * wget supports --bind-address parameter: https://www.gnu.org/software/wget/manual/wget.html#Download-Options * Python accepts optional “source_address” parameter: https://docs.python.org/2/library/socket.html#socket.create_connection * “bind before connect”, a blog post that seems to be relevant: https://idea.popcount.org/2014-04-03-bind-before-connect/ * curl seems to allow it too, but surprisingly it can also accept the interface name: https://curl.haxx.se/docs/manpage.html#--interface It is possible to find more examples of languages that support it, but I'm sold already. My best guess is that it is doable by simply calling uv_tcp_bind for outgoing connections. Relevant links: * https://github.com/MoarVM/MoarVM/blob/2a79727deb78105c8c9f660a1136a3db1179b09b/src/io/asyncsocket.c#L532-L533 * https://github.com/MoarVM/MoarVM/blob/2a79727deb78105c8c9f660a1136a3db1179b09b/src/io/asyncsocket.c#L681-L683


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org