mIRC Home    About    Download    Register    News    Help

Print Thread
ipv6 socket server - accepting ipv4 #269465 09/10/21 11:56 AM
Joined: Jul 2006
Posts: 3,833
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,833
When you create an ipv6 listening socket in mIRC, TCP or UDP, at the lower level in winsock, there is a member in a structure that's always on by default on Windows: IPV6_V6ONLY
This parameter means that for an ipv6 socket, by default, it will only accept/connect to ipv6 connections/server, this is not great in many cases (that parameter can be found off by default on different OS).
For example, creating a game server which has to accept anyone, so any version of ip.
If this option is turned off, ipv4 connection should be able to connect to ipv6 server, the ipv4 will be mapped to some ipv6 addresses.
In fact it looks like this also works for ipv6 client to ipv4 server.
I would like to get support for this via some switch in /socklisten, /sockudp -k and eventually /sockopen but i'm really looking for the server side of it

https://docs.microsoft.com/en-us/windows/win32/winsock/dual-stack-sockets


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: ipv6 socket server - accepting ipv4 [Re: Wims] #269466 09/10/21 04:44 PM
Joined: Dec 2002
Posts: 5,034
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,034
I looked into this long ago when I first added IPv6 support. At the time, I decided not to add support for it since dual stack was not supported by XP, which was still widely used. I'll add this to my to-do list. However, since mIRC is still technically supporting XP, be aware that this option will not work on XP.

Re: ipv6 socket server - accepting ipv4 [Re: Khaled] #269712 21/12/21 05:01 PM
Joined: Jul 2006
Posts: 3,833
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,833
Thanks for adding this in the new beta, I did not expect it to be added at all after your reply, I'll try to beta test it as soon as i can.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: ipv6 socket server - accepting ipv4 [Re: Wims] #269751 11/01/22 02:11 AM
Joined: Jul 2006
Posts: 3,833
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,833
I was on vacations for a while, I just tested it locally, both tcp and udp, ipv6 server and connecting to 127.0.0.1 resulted in $sock(name).ip being ::ffff:127.0.0.1 from the server's point of view.
For tcp, I'm not the one actually using the value since it's abstracted but it worked perfectly, I'm in charge of using the value for udp and it also worked perfectly without any modification.

Note that one absolutely needs a bind to an ipv6 address for dual socket to work.
If you do not use the -d switch to control the bind yourself on /socklisten and /sockudp, and depending on the mIRC options for binding at alt o > connect > options > port, the bind may not be ipv6 and a simple "/socklisten -u name port" would then not bind to an ipv6 address. This is important and it would be great if it were explained in the help file.

One should always control the bind with the -d switch because iirc, in some situations, the default bind for a socklisten is not according to the binding option. I need to check this more.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net