public void SendNatIntroduceRequest(IPEndPoint masterServerEndPoint, string additionalInfo) { //prepare outgoing data NetDataWriter dw = new NetDataWriter(); string networkIp = NetUtils.GetLocalIp(LocalAddrType.IPv4); if (string.IsNullOrEmpty(networkIp)) { networkIp = NetUtils.GetLocalIp(LocalAddrType.IPv6); } IPEndPoint localEndPoint = NetUtils.MakeEndPoint(networkIp, _socket.LocalPort); dw.Put((byte)PacketProperty.NatIntroductionRequest); dw.Put(localEndPoint); dw.Put(additionalInfo, MaxTokenLength); // Get Internet IP var publicIp = NetUtils.GetPublicIPAddress(); IPEndPoint internetEndpoint = NetUtils.MakeEndPoint(publicIp, 0); dw.Put(internetEndpoint); // //prepare packet SocketError errorCode = 0; _socket.SendTo(dw.Data, 0, dw.Length, masterServerEndPoint, ref errorCode); }