I am trying to accept IPv4 connections on my server that is listening on an IPv6 TCP socket.
I was currently working on porting a blocking socket example i'm using for some tutorials i've been making, and i've noticed behavior that I did not expect.
Current github dev branch: https://github.com/Pindrought/PNet/tree/TCP_Blocking_Winsock_Tutorial_17Dev
My client is connecting using an IPv4 socket.
My server is accepting connections on an ipv6 socket, and i've disabled the IPV6_V6ONLY socket option to allow both ipv4 and ipv6 incoming connections.
The connections are accepted just fine - the confusion for me arises in the fact that the accepted connection appears to be an IPv6 connection according to the address family in the sockaddr struct.
I was under the impression that the ipv4 connection would have an address family of AF_INET6.
Is this expected behavior? I just want to make sure that i'm not doing anything wrong here. If this is expected behavior, is there any way I can determine from the server side if the connecting client did so using IPv4 or IPv6?
Thanks!
Edited to add:
This is the output my server has
QuoteWinsock api successfully initialized.
Socket successfully created.
Socket successfully listening on port 4790.
New IPv6 connection accepted!
IP Version: IPv6
Hostname: ::ffff:127.0.0.1
IP: ::ffff:127.0.0.1
Port: 59191
IP bytes...
0
0
0
0
0
0
0
0
0
0
255
255
127
0
0
1
New connection accepted.