private void connectToServer() { var factory = new TokenFactory(0x1122334455667788L, _privateKey); clientId = Random.Range(1, 100); string ip = "192.168.1.70"; ip = "54.243.1.231"; byte[] connectToken = factory.GenerateConnectToken( new IPEndPoint[] { new IPEndPoint(IPAddress.Parse(ip), 12345), new IPEndPoint(IPAddress.Parse("0.0.0.0"), 12345) }, 30, 5, 1UL, (ulong)clientId, new byte[256]); client.Connect(connectToken); client.OnStateChanged += UpdateStatus; client.OnMessageReceived += (payload, payloadSize) => { endpoint.ReceivePacket(payload, payloadSize); }; endpoint = new ReliableEndpoint { ReceiveCallback = (buffer, size) => { var packet = PacketGenerator.DecodePacket(buffer); if (packet.TickId > tick) { processor.Process(packet); tick = packet.TickId; } else { print("Skip: " + packet); } }, TransmitCallback = (payload, payloadSize) => { client.Send(payload, payloadSize); } }; }