Hello,
I use Lidgren network on my game and I changed the library for support ipv6.
My change is based on this implementation (but without the dualmode)
https://github.com/lidgren/lidgren-network-gen3/pull/33/commits/1d99bb8e41b82e8d7d43b6e94fe97924aa5c...
All works fine on Mono in ipv4 and ipv6 but on L2Cpp the app is locked into the "connecting" stage without giving errors.
The server (ipv4 only) address is successfully converted in ipv6 in both L2cpp and Mono modes.
Maybe is this a problem of the L2CPP implementation?
The problem is the same on Unity 4.7.2 and Unity 5.3.5p7.
Thank you
Gabriel
This is the IOS plugin I use for convert an ip4 IP to ipv6
//FILE H
@interface ipv6 : NSObject
+(NSString *)getIPv6 : (const char *)mHost Smiley Sadconst char *)mPort Smiley Sadbool*) isIpv6;
@End
// FILE .M
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <err.h>
#define
MakeStringCopy( _x_ ) ( _x_ != NULL && [_x_
isKindOfClass:[NSString class]] ) ? strdup( [_x_ UTF8String] ) : NULL
const char* getIPv6(const char *mHost,const char *mPort,bool* isIpv6)
{
if( nil == mHost )
return NULL;
const char *newChar = "No";
const char *cause = NULL;
struct addrinfo* res0;
struct addrinfo hints;
struct addrinfo* res;
int n, s;
*isIpv6 = false;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_DEFAULT;
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
if((n=getaddrinfo(mHost, "http", &hints, &res0))!=0)
{
printf("getaddrinfo error: %s\n",gai_strerror(n));
return NULL;
}
struct sockaddr_in6* addr6;
struct sockaddr_in* addr;
NSString * NewStr = NULL;
char ipbuf[32];
s = -1;
for(res = res0; res; res = res->ai_next)
{
if (res->ai_family == AF_INET6)
{
addr6 =( struct sockaddr_in6*)res->ai_addr;
newChar = inet_ntop(AF_INET6, &addr6->sin6_addr, ipbuf, sizeof(ipbuf));
NewStr = [[NSString alloc] initWithCStringSmiley Sadconst char*)newChar
encoding:NSASCIIStringEncoding];
*isIpv6 = true;
printf("%s\n", newChar);
}
else
{
addr =( struct sockaddr_in*)res->ai_addr;
newChar = inet_ntop(AF_INET, &addr->sin_addr, ipbuf, sizeof(ipbuf));
NewStr = [[NSString alloc] initWithCStringSmiley Sadconst char*)newChar
encoding:NSASCIIStringEncoding];
printf("%s\n", newChar);
}
break;
}
freeaddrinfo(res0);
printf("getaddrinfo OK");
NSString * mIPaddr = NewStr;
return MakeStringCopy(mIPaddr);
}
------------
Connect remoteEndPoint :64:ff9b::25bb:880d:14240
START HANDSHAKE WITH 64:ff9b::25bb:880d:14240
When i received the first packet...from
m_socket.ReceiveFrom(m_receiveBuffer, 0,m_receiveBuffer.Length, SocketFlags.None, ref m_senderRemote);
the m_senderRemote report this :
IP : 2b16:64:ff9b::25bb%3464
ENDPOINT : 2b16:64:ff9b::25bb%3464:30630
Look like a broken IPV6...right ?
Note : This only on Il2CPP on .Net work