public DualConnection(Socket socket, IPAddress ip = null)
        {
            tcpConnetion = new TCPPacketConnection(socket);

            if (ip != null)
            {
                udpConnection = new UDPConnection(new IPEndPoint(ip, (socket.LocalEndPoint as IPEndPoint).Port));
            }
            else
            {
                udpConnection = new UDPConnection(socket.LocalEndPoint);
            }

            udpConnection.SetDefaultSend(socket.RemoteEndPoint);

            OnDisconnect += HandleTCPDisconnect;
            tcpConnetion.DataReceivedEvent  += TcpConnetion_DataReceivedEvent;
            udpConnection.DataReceivedEvent += UdpConnection_DataReceivedEvent;
        }
예제 #2
0
 protected override void CreateActions(Socket socket)
 {
     Connection = new UDPConnection(socket.LocalEndPoint as IPEndPoint);
     Connection.SetDefaultSend(socket.RemoteEndPoint as IPEndPoint);
     Connection.Logger = Logger;
 }