Ejemplo n.º 1
0
 public void SetupServer()
 {
     Log.LogManager.Level = Log.LogLevel.Fatal;
     _config = new CoapConfig();
     _config.DefaultBlockSize = 32;
     _config.MaxMessageSize   = 32;
     CreateServer();
     _clientEndpoint = new CoAPEndPoint(_config);
     _clientEndpoint.Start();
 }
Ejemplo n.º 2
0
        public void SetupServer()
        {
            Log.LogManager.Level = Log.LogLevel.Fatal;
            _config = new CoapConfig();
            _server = new CoapServer();
            CoAPEndPoint endpoint = new CoAPEndPoint(_serverPort, _config);

            _server.AddEndPoint(endpoint);
            _server.Add(new TestResource(TARGET));
            _server.Start();
        }
Ejemplo n.º 3
0
        private void CreateServer()
        {
            CoapConfig config = new CoapConfig();

            config.NonTimeout = 10;

            CoAPEndPoint endpoint = new CoAPEndPoint(0, config);

            _resource = new StorageResource(TARGET, CONTENT_1);
            _server   = new CoapServer();
            _server.Add(_resource);

            _server.AddEndPoint(endpoint);
            _server.Start();
            _serverPort = ((System.Net.IPEndPoint)endpoint.LocalEndPoint).Port;

            Resource r2 = new EchoLocation("abc");

            _server.Add(r2);

            r2.Add(new EchoLocation("def"));
        }
Ejemplo n.º 4
0
        public void SetupServer()
        {
            Log.LogManager.Level = Log.LogLevel.Fatal;
            CoapConfig config = new CoapConfig();

            config.Deduplicator         = "MarkAndSweep";
            config.MarkAndSweepInterval = TEST_SWEEP_DEDUPLICATOR_INTERVAL;
            config.ExchangeLifetime     = TEST_EXCHANGE_LIFETIME;
            config.MaxMessageSize       = TEST_BLOCK_SIZE;
            config.DefaultBlockSize     = TEST_BLOCK_SIZE;

            // Create the endpoint for the server and create surveillant
            _serverEndpoint    = new CoAPEndPoint(config);
            _serverSurveillant = new EndpointSurveillant("server", _serverEndpoint);
            _clientEndpoint    = new CoAPEndPoint(config);
            _clientEndpoint.Start();
            _clientSurveillant = new EndpointSurveillant("client", _clientEndpoint);

            // Create a server with two resources: one that sends piggy-backed
            // responses and one that sends separate responses

            _server = new CoapServer(config);
            _server.AddEndPoint(_serverEndpoint);
            TestResource piggyRes    = new TestResource(PIGGY, Mode.PiggyBacked);
            TestResource separateRes = new TestResource(SEPARATE, Mode.Separate);

            _server.Add(piggyRes);
            _server.Add(separateRes);
            _server.Start();
            _serverPort = ((System.Net.IPEndPoint)_serverEndpoint.LocalEndPoint).Port;

            _timer = new Timer(o =>
            {
                piggyRes.Fire();
                separateRes.Fire();
            }, null, 0, OBS_NOTIFICATION_INTERVALL);
        }