예제 #1
0
        /// <summary>Initializes a new instance of the SocketTestContext class.</summary>
        public SocketTestContext()
        {
            ClientSockets = new List<Socket>();
            AcceptedSockets = new List<Socket>();
            DataReceived = new List<byte[]>();

            ClientSocket = new Socket();
            ClientSocket.ConnectionStateChanged += OnConnectionStateChanged;
            ClientSocket.DataReceived += OnDataReceived;

            ListenerSocket = new Socket();
            ListenerSocket.ConnectionAccepted += OnClientSocketAccepted;
        }
예제 #2
0
 /// <summary>Initializes a new instance of the SocketEventArgs class using the specified socket and buffer.</summary>
 /// <param name="socket">Socket.</param>
 /// <param name="buffer">Buffer.</param>
 internal SocketEventArgs(Socket socket, byte[] buffer)
 {
     Socket = socket;
     Buffer = buffer;
 }
예제 #3
0
 /// <summary>Initializes a new instance of the SocketEventArgs class using the specified socket and connection state.</summary>
 /// <param name="socket">Socket.</param>
 /// <param name="connectionState">Socket connection state.</param>
 internal SocketEventArgs(Socket socket, ConnectionState connectionState)
 {
     Socket = socket;
     ConnectionState = connectionState;
 }
예제 #4
0
 /// <summary>Creates new socket.</summary>
 /// <returns>New socket.</returns>
 public Socket NewSocket()
 {
     var ns = new Socket();
     ClientSockets.Add(ns);
     return ns;
 }