/// <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; }
/// <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; }
/// <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; }
/// <summary>Creates new socket.</summary> /// <returns>New socket.</returns> public Socket NewSocket() { var ns = new Socket(); ClientSockets.Add(ns); return ns; }