Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
I think Socket::Inet could be a bit changed on how it's implemented.
Currently it has 2 defaults :
-The SA Familly attribute is totally ignored.
This means like in a case of localhost being ipv4 and ipv6 the user has no control over what protocole will be used.
-No way to specify on wisch ip/interface you want to bind your socket when you use connect
This mean that a server with multiple ip can't use them.
Proposed changes to fix that:
Use the argument passed to nqp::socket to specify the sa family. (actually it does nothing in MoarVM, look like a parrot reliquat?)
This will have 3 values: IPv4 IPv6 (AF_INET, AF_INET6) or Prefered
Prefered mean it will choose what the hostname resolution give us first. The 2 other will force the use of this family.
Change nqp::bindsock to only bind the socket and not do listen and a nqp::listensock operation that will listen.
This allow the case of specified source address directly in Rakudo, since it's a bind operation before connecting the socket.
This will also need to add a field for the sa-family in the MoarVM socket structure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.