Beispiel #1
0
        public static KcpSocket CreateSvr(IPEndPoint iPEndPoint, RawReceiveHandler rawReceiveHandler)
        {
            var ks = new KcpSocket(SocketHelper.GetUdpSvrSocket(iPEndPoint), rawReceiveHandler);

            ks.IPPortLocal = iPEndPoint;
            return(ks);
        }
Beispiel #2
0
        public static KcpSocket CreateClient(IPEndPoint remote, RawReceiveHandler rawReceiveHandler)
        {
            var ks = new KcpSocket(SocketHelper.GetUdpClientSocket(), rawReceiveHandler);

            ks.IPPortLocal  = (IPEndPoint)ks._socket.LocalEndPoint;
            ks.IPPortRemote = remote;
            return(ks);
        }
Beispiel #3
0
 private KcpSocket(Socket _socket, RawReceiveHandler rawReceiveHandler)
 {
     this._socket = _socket;
     rawReceive   = rawReceiveHandler;
     BootTime     = DateTimeOffset.UtcNow;
 }