示例#1
0
        private void Start()
        {
            Log.WriteLine("Creating TCP Device");  // moar logs
            server = new CloNET.Server(ip, port)   // creating the server from the port ant ip
            {
                Encryption = new EncryptionOptions // setting encryption off
                {
                    Encrypt     = false,
                    Overridable = false
                },
                Compression = new CompressionOptions // setting compression off
                {
                    Compress    = false,
                    Overridable = false
                }
            };

            // server events
            server.Connected    += OnConnect;
            server.Disconnected += OnDisconnect;
            Log.WriteLine("TCP Created, starting TCP");
            // starting the server
            try { server.Listening = true; }
            // catching a port in use exception
            catch (SocketException)
            {
                Log.WriteLine("The specified port (" + port + ") is already in use.");
                return;
            }
            Log.WriteLine("TCP Started, Listening for connections...");

            AddCallbacks(); // adding the callbacks to the server for use from client
        }
示例#2
0
        public DownServer()
        {
            server = new CloNET.Server(IP, PORT)
            {
                Compression = new CompressionOptions
                {
                    Compress    = false,
                    Overridable = false
                },
                Encryption = new EncryptionOptions
                {
                    Encrypt     = false,
                    Overridable = false
                }
            };
            server.Connected    += ConnectedClient;
            server.Disconnected += DisconnectedClient;

            AddCallbacks();

            server.Listening = true;
        }