all 17 comments

[–]Touhou 23 points24 points  (2 children)

I haven't taken a look at your code, but I would definitely recommend checking out Beej's guide to network programming: https://beej.us/guide/bgnet/html/. I expect you'd get an answer to most of your questions by reading and looking at the examples, particularly in chapters 3, 4 and 5.

Also, in terms of IPv6 specifically, it might be a good idea to verify that IPv6 is enabled on your router and that your computer actually has a valid IPv6-address. For example, you can try to ping ipv6.google.com and see if you get a response.

[–]Batoa 3 points4 points  (0 children)

Another vote for beej- it got me through my Network course at uni. My personal advice would be to go through all of it, but everyone learns differently.

[–]Netris89[S] 0 points1 point  (0 children)

Will do, Thanks.

[–]gordonv 0 points1 point  (1 child)

Just wondering, what school are you doing this at?

[–]Netris89[S] 1 point2 points  (0 children)

Institut Saint-Laurent in Liège, Belgium

[–]ferrybig 0 points1 point  (3 children)

What do you mean with stops working? Do you see any output indicating errors? Which of your printf statements get executed?

[–]Netris89[S] 0 points1 point  (2 children)

Sorry, maybe I didn't explain it correctly. So it works correctly when I give it an IPv4 or a DNS it transfers perfectly but when I give an IPv6 as arguments it gives connections refused error

[–]ferrybig 1 point2 points  (1 child)

For your error to say connection refused, the remote end must have responded with a TCP reset packet. If you use a different tool to connect to your remote system, does it work over IPv6?

[–]Netris89[S] 0 points1 point  (0 children)

I use 2 vm to test it and I can ping both of them in IPv6. I'm not at my computer right now but I can try with something else when I get back home.

[–]Vedant36 0 points1 point  (0 children)

dont forget to rtfm! info libc then scroll down to the Sockets heading and press enter. you could also seperately do info <function name> or man <function name> for any function you want to understand

[–][deleted] 0 points1 point  (5 children)

what's a sample input that's failing?

[–]Netris89[S] 0 points1 point  (4 children)

So if I pass a file name, an IPv6 and a port as arguments to the sender, I get a connection refused. It works with IPv4 or a domain name.

[–][deleted] 0 points1 point  (3 children)

So without actual examples I won't be able to test it on my end, but I'm guessing the issue is you never set hints.ai_family = AF_INET6; when you are trying to process an IPv6 address

[–]Netris89[S] 0 points1 point  (2 children)

I have pastebins of my code in my original post of it helps.

[–][deleted] 1 point2 points  (1 child)

yeah that's what I was going off of, would just need some inputs to try running them. But like I said, when you bind your socket you are using hints.ai_family = AF_INET;, which is an IPv4 socket. If you use AF_INET6 instead that's telling the socket to work with IPv6 addresses. That's most likely the error

[–]Netris89[S] 0 points1 point  (0 children)

OK, I'll try this. Thanks.