Exemple #1
0
        public static ICommunicator CreateCommunicator(Int32 port, Int32 transferBlockSize)
        {
            CoapConfig config = new CoapConfig();

            config.Port = port;
            config.TransferBlockSize = transferBlockSize;
            return(CreateCommunicator(config));
        }
 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();
 }
 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();
 }
 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();
 }
Exemple #5
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();
        }
Exemple #6
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);
        }