Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net.recvFrom address is always "0.0.0.0" for ipv6 #7634

Closed
enthus1ast opened this issue Apr 16, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@enthus1ast
Copy link
Contributor

commented Apr 16, 2018

import net
var socket = newSocket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP)
socket.bindAddr(Port(1900), "::")
var 
  data: string = ""
  address: string = ""
  port: Port

while true:
  echo "R: ", socket.recvFrom(data, 1024, address, port ), " ", address,":", port, " " , data
  # now send to it `echo "test" | ncat -u -6 "::1" 1900`
  # R: 5 0.0.0.0:48147 test

@dom96 dom96 added the Stdlib label Apr 16, 2018

@enthus1ast

This comment has been minimized.

Copy link
Contributor Author

commented May 22, 2018

It seems to be the case that (at least on linux) it depends on the address you bound to
what AF_INET version gets returnd by recvFrom.

So if you bound to an ipv6 address: every incoming connection (even if it connects to your ipv4 address, and comes from ipv4) has AF_INET6 set.

It seemd to be mapped to ipv6?

LemonBoy added a commit to LemonBoy/Nim that referenced this issue Jan 30, 2019

LemonBoy added a commit to LemonBoy/Nim that referenced this issue Jan 30, 2019

narimiran added a commit that referenced this issue Jan 31, 2019

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.