Ejemplo n.º 1
0
        protected virtual Socket CreateSocket(TcpServiceEndPoint serviceEndPoint)
        {
            var socket = new Socket(serviceEndPoint.EndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);

            socket.Bind(serviceEndPoint.EndPoint);
            return(socket);
        }
Ejemplo n.º 2
0
 protected void InitializeAndHandleClientHelper(TcpServiceClientBase client, TcpServiceEndPoint serviceEndPoint, Socket clientSocket, IPEndPoint remoteEndPoint)
 {
     client.ClientService  = this;
     client.ClientSocket   = clientSocket;
     client.ClientEndPoint = remoteEndPoint;
     ThreadPool.QueueUserWorkItem(o => (o as TcpServiceClientBase).OnConnect(), client);
 }
Ejemplo n.º 3
0
 public ServiceSocket(Socket socket, TcpServiceEndPoint endPoint)
 {
     Socket          = socket;
     ServiceEndPoint = endPoint;
 }
Ejemplo n.º 4
0
 protected abstract void HandleClientSocket(TcpServiceEndPoint serviceEndPoint, Socket clientSocket, IPEndPoint remoteEndPoint);
Ejemplo n.º 5
0
 protected override void HandleClientSocket(TcpServiceEndPoint serviceEndPoint, Socket clientSocket, IPEndPoint remoteEndPoint)
 {
     InitializeAndHandleClientHelper(new TClient(), serviceEndPoint, clientSocket, remoteEndPoint);
 }