Пример #1
0
        /// <summary>
        /// Create a new TCP/IPv4 socket that will act as a server.
        /// </summary>
        public ServerSocket()
        {
            this.Sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            this.Port = 0;

            this.Listening = false;

            this.OnConnect    = null;
            this.OnReceive    = null;
            this.OnDisconnect = null;
        }
Пример #2
0
        /// <summary>
        /// Create a new TCP/IPv4 socket that will act as a client.
        /// </summary>
        public ClientSocket()
        {
            this.Sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            this.Sock.ReceiveBufferSize = Kernel.MAX_BUFFER_SIZE;
            this.Sock.SendBufferSize    = Kernel.MAX_BUFFER_SIZE;

            this.Buffer = new Byte[Kernel.MAX_BUFFER_SIZE];

            this.Alive = false;

            this.OnConnect    = null;
            this.OnReceive    = null;
            this.OnDisconnect = null;
        }