public void ConnectWithAnyLocalEndPoint(IPv4 dstIP, ushort dstPort) { DebugPrint( "ConnectWithAnyLocalEndPoint (-> {0:x8}/{1})\n", dstIP, dstPort ); udp.Connect(dstIP, dstPort); state = State.Connected; }
public void Connect(IEndPoint endPoint) { receiveEndPoint = (NanoEndPoint)endPoint; InitSocket(); int result = UDP.Connect(socket, ref receiveEndPoint.address); if (result != 0) { throw new NanoSocketException("Socket Connect failed"); } }
public void Connect(string ipPARAM, int portPARAM) { IP = ipPARAM; Port = portPARAM; Tcp = new TCP(this); Tcp.Connect(); Udp = new UDP(this); Udp.Connect(); GameManager.gameManager.isConnected = true; }
private void OnConnectInvoked() { if (useUDP) { udp = new UDP(ip, port, id, HandlePacket); udp.Connect(((IPEndPoint)tcp.socket.Client.LocalEndPoint).Port); } if (OnConnect != null) { OnConnect(); } }
private void ServerWelcome(Packet _packet) { int _myId = _packet.ReadInt(); isConnected = true; Debug.Log($"Connected to server."); myId = _myId; WelcomeReceived(); udp.Connect(((IPEndPoint)tcp.socket.Client.LocalEndPoint).Port); ConnectedToServer(); }
/// <summary>Connect the client with the tcp and udp protocol.</summary> /// <param name="tcpSocket">Socket to link client and server in tcp.(set to null if you don't want to change it)</param> /// <param name="udpEndpoint">IP of the client to send udp data.(set to null if you don't want to change it)</param> public void Connect(TcpClient tcpSocket, IPEndPoint udpEndpoint) { //Connect the tcp Tcp = new TCP(this); if (tcpSocket != null) { Tcp.Connect(tcpSocket); } //Connect the udp Udp = new UDP(this); if (udpEndpoint != null) { Udp.Connect(udpEndpoint); } }