Giter Site home page Giter Site logo

coap.net's People

Contributors

delmet avatar longshine avatar martindevans avatar robreeves avatar simet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coap.net's Issues

CoAP client through mobile hotspot

Hello,

I have developed an android CoAP client application using Californium java, and the server side using CoAP.NET C#. And I have noticed that there are some places where the server responses never reach the client. I can see the correct request in the server and it replies, but the reply never reaches the client.

I can reproduce this easily by connecting the android smartphone client wifi to a hotspot created by another smartphone.

Is there someone which knows why this happen?

Best Regards,
Fábio Cardoso

CoAP Cancel Observe Option

Hi,

I am having problem in cancelling registered observe option, making use of this function MarkObserveCancel(), but i see multiple observe option is registered for the same resource in wireshark.
How do I cancel these individually based on tokens ?

edwin

Nuget package out of date.

I submitted this pull request a while ago. However, it seems that this hasn't been pushed out to nuget yet. Could you update the nuget package to a newer version?

Stack overflow on some OS when UDP channel begins receiving on .NET 4

Problem

On some OS, if we set up an dual channel server, with IPv4-mapped IPv6 addresses enabled, the call to Socket.ReceiveFromAsync(SocketAsyncEventArgs) may fail and throw an ArgumentException saying "Invalid AddressFamily".

The flow is like:

  • set up a socket, bind with an IPv6 address;
  • in 'BeginReceive', at first ReadBuffer.RemoteEndPoint is null, set to AddressFamily.InterNetworkV6;
  • in EndReceive(), if the received endpoint is IPv4-mapped, it will be changed to AddressFamily.InterNetwork;
  • then back to 'BeginReceive', call Socket.ReceiveFromAsync() again.

In this case, an endpoint of AddressFamily.InterNetwork will be passed into the socket, resulting in an ArgumentException. And the 'BeginReceive' will be started again, leading to an infinite recursion loop.

This happens in a PC with Win7 Ult, but not in another one with Win7 Ult SP1. I am wondering if there is anything happens in the .NET framework or IPv6 stack.

Solution

Create new IPEndPoint instead of changing the IP address of the original one.
Commit 49838af fixes this issue.

Backward compatibility

No backward compatibility problems are expected.

CoAP.NET-master Client and Server issue

HI,
I am running project from CoAP.NET-master CoAP.NET40.2010 when i build the solution it shows no error. Looks like in image 1
image

After build the solution shows no error. I set CoAP.Server.NET40 project under examples as a startup project and run the solution.

I add some line of code in main method of Examples/CoAP.Client.NET40 project and run the project as a new instance when I debug the code return nothing in response
image

Request request1 = new Request(Method.GET);
request1.URI = new Uri("coap://localhost:5683/hello-world");
request1.SetPayload("Hello hi", MediaType.TextPlain);
Request reqRes = request1.Send();

// wait for one response
Response response1 = request1.WaitForResponse();

Please let me know what should i pass from the client side and how i will process request on the server side. I want to implement CON,NON, “/.well-known/core”,“Separate Response”,“Observable” option using this code and want to process the request on the server side.

Thanks

Unexpected SocketException of AddressFamilyNotSupported if IPv6 is not supported by the OS

Problem

If IPv6 is not supported by the OS (i.e. WinXP without IPv6 protocol installed), a SocketException of SocketError.AddressFamilyNotSupported will be thrown when starts a server.

Solution

Commit 1f33943 fixes this issue.

Backward compatibility

No backward compatibility problems are expected.

Workaround

If you cannot upgrade to latest code, you can manually add a CoAPEndPoint of an IPv4 address before starting the server.

CoapServer server = new CoapServer();
server.AddEndPoint(new CoAPEndPoint(new IPEndPoint(IPAddress.Any, 5683)));

Reject an exchange doesn't generate a RST paquet

Hello,

I did a very simple ressource :

class RejectedResource: Resource
    {
        public RejectedResource() : base("RejectedResource")
        {
            Attributes.Title = "RejectedResource";
        }

        protected override void DoGet(CoapExchange exchange)
        {
            exchange.Reject();
        }
    }

But when I try to request a GET on this resource, the server never generate a RST message...
Nothing is sent at all.

Thanks for your help.

CoAP.NET-master Client and Server issue

HI,
When I send the request to server and process the request using below code working fine
protected override void DoGet(CoapExchange exchange)
{
// the request contains all the info you sent from your client
Request request = exchange.Request;
// get payload from the request
string payload = request.PayloadString;

    // and respond it
    exchange.Respond("Hello" + payload);
}

But when I call REST API for processing the request payload data which take some time for processing the request after process the request when i respond(exchange.Respond("Hello");) to client it returns null.

protected override void DoGet(CoapExchange exchange)
{
// the request contains all the info you sent from your client
Request request = exchange.Request;
// get payload from the request
string payload = request.PayloadString;

// process the payload data request using RESTAPI which takes some time in process

    // and respond it
    exchange.Respond("Hello" + payload);
}

Please let me know what is the issue?

Thanks
Shreyansh Jian

Question on Root Resource

example:
class RootResource : Resource
{
public RootResource() : base(String.Empty)
{
Attributes.Title = "Home";
}

    protected override void DoGet(CoapExchange exchange)
    {
        exchange.Respond("Welcome !");
    }

}

but not work. help, thanks.

Queries on Coap .NET features

Hi,

Sorry, again I am still very new to this. I was wondering if the current Coap.NET implements any security features? It is a nice to use library that will be added bonus if it has good security features.

Also, is there any enhancement features that are in progress/coming up for this framework?

Thanks and regards,
ML

CoAP.NET.Core memory leak

Hi,

wonderful work on this lib but I use CoAP.NET.Core and I saw an important memory leak on the lib.

Here is the code leaking :

protected override void DoGet(CoapExchange exchange)
{
       exchange.Accept();
       //Response res = Response.CreateResponse(exchange.Request, StatusCode.Valid);
       //res.ContentType = (int)GetContentType();
       //res.Payload = Serialize();
       exchange.Respond("Toto");        
}

My program starts with 12MB of RAM consumed and after 1000 requests we reached 21MB, 3000 27MB, 10000 57MB and it never decreased.

Have you any idea?

Identity and Key

For accessing my CoAP Server I need to use an Identity and Key.

How to I configure the Identity and Key for the Client?

Regards,
Stefan Stranger

response with request

In the server side,may I send a request after response.
I try that after
exchange.Respond(...)

Request request = Request.NewGet();
request.Destination = exchange.Request.Source;
exchange.Request.EndPoint.SendRequest(request);

it donot work

Question on observed resource

Hi,

I am very new to coap.net and I have some questions regarding observed resource. I am using coap.net framework and tried to call "time" resource on client's side and it works (using "OBSERVE").

However, I am still not very sure on how the subscription to this resource can be stopped explicitly on client's side (probably a RST response to clear observation or something?).

Could you provide some examples on how it can be done?

Thanks!
ML

Coap.Net

Hi,
Please let me know how we can send the token to COAP server and how we can define message type (CON, NON, ACK, RST) when we send client request to COAP server.

Thanks

Setting MaxRetransmit in config has no effect

I'm constructing a CoapClient with a custom config to disable re-transmits:

var config = new CoapConfig
{
    MaxRetransmit = -1,
};
_client = new CoapClient(config);

However, messages are still re-transmitting the default 4 times. I'm using GetAsync and PutAsync to send messages.

If I explicitly construct a Get Request and set its MaxRetransmit to -1 and send it using SendAsync, then it behaves as expected and does not retransmit.

CoAP Blockwise transfer

Hi,
I am new to this CoAP project and i am making using use of coap.net.
Working on blockwise transfer in order to GET payload of 100 bytes.
How do I start with this? I read the latest RFC on blockwise transfer where it says make use of blockoption 2 for GET method.
Any way to approach this / sample code / pointers would be appreciated

Best Regards,
Sachin Edwin

How do you set the log level?

By default the Level in LogManager is LogLevel.All. I do not see where I can change that to increase the level past debug.

Multicast not working on the specified interface/IP

I was trying to perform a Get to ''.well-known/core" using multicast:

            // new a GET request
            Request request = new Request(Method.GET, false);
            request.Source = new IPEndPoint(IPAddress.Parse("10.132.1.58"), 5683);

            request.Multicast = true;
            request.URI = new Uri("coap://224.0.1.187/.well-known/core");
            request.Send();

            // wait for one response
            Response response = request.WaitForResponse();

            Console.WriteLine(response.PayloadString);

This doesn't seem to work, as it seems that the packet is not sent from the source I specified. Intestead, it will be using another interface which is not connected to the IoT network.

As a workaround, I had to disable the other networks.

CoAP.NET-master Client and Server issue

HI,
Thanks for your valuable response on my pre issues.

I want to configure COAP.Net protocol in WCF. is it possible to configure endpoint in WCF which supports COAP.Net protocol.

Thanks
Shreyansh

coap.net

Hi,
Please let me know how i will provide the security in coap server. Is there any possible way to provide security. How to implement proxy between client and server.
Please share me any link or document for COAP which contains all the details about COAP .

Thanks

CoAP.NET over compact Net Framework 3.5

I was planning to run this library in windows mobile 6.1 with compact net framework 3.5, however I could not run in the mobile emulator , It requires libraries from compact .net Framework 4.0.

Does CoAP.NET supports .NET compact framework 3.5

CoAP.NET-master Client and Server issue

Hi,
I want to receive multiple times response from single request.
From the client I will send a request to server after receiving this request i want to response client multiple times with single request. Is there any way to implement this feature using COAP.net.

Thanks
Shreyansh jain

CoAP Observe Option

Hi,

I was able to register my CoAP sensor resource successfully and I get this notification every 30 secs, now I want to display this notification on a windows application, so for every change in state of the resource I want my display field to be updated. How do I handle this ? I see the notifications on wireshark, my windows application should get these notifications. How do I approach this ?

Edwin

CoAP.NET-master Client and Server issue

Hi,
I downloaded https://github.com/smeshlink/CoAP.NET. There are a number of resources in Example/Server CarelessResource, FibonacciResource, HelloWorldResource, ImageResource, LargeResource, MirrorResource, SeparateResource,StorageResource, TimeResource. I register these resources from main method. Now I want to call each resources from client. Please let me know what should I pass argument in Client for access each Resources? Is there any document for access these resources.

How we will implement the proxy in CoAP.Proxy.NET40?

Thanks
Shreyansh

F# Interactive client with 4.05 status

I successfully created and communicated with the demo server, a COMPILED F# CoAP clients based on the examples as DISCOVER coap://localhost and GET coap://localhost/hello.
But when I try the exact same code using F# interactive (REPL), I get: "Status : 4.05 Method Not Allowed".
Also, I did the same test, but using a CoAP server in F# interactive with the same behavior.
I am looking for suggestions why this is happening and how is the best way to debug the problem.

Invalid getter for ProxyUri and ProxyScheme?

Hi,

I've just found in class Message that getters for ProxyUri and ProxyScheme get option OptionType.Accept but set valid option.

Is that correct?

I was very surprised when I set option Accept and the Utlis.OptionsToString returned something in ProxyScheme.

CoAP.NET-master Client and Server issue

Hi,
I am creating a resource and implement DoGet method of this resource. I have number of different Get request. Is it possible to create multiple DoGet method in single resource or using query string.
Please let me know how we will manage it. How we will manage query string in COAP.net?

Thanks
Shreyansh

Observe timeout

##Good day!

I use you library for having comminication with sensortag by Coap protocol.
But I have a problem after long time observe.
I do this:

Request request = GetRequest(type);
request.AckTimeout = -1; //To make timeout unlimit
request.Respond += (s, e) => method(s, e, new Guid(guid));
request.MarkObserve();

So it work, but after 10-12 hours timeout is occured and observer didnt work. I should observe to resource again. Why do it happen?

My sensortag sleep one hour then wakeup, send data by coap to client and sleep again

Unable to send acknowledgement from CoAP server to CoAP client

I am using following code:

server.FindEndPoint(5683).ReceivingRequest += new EventHandler<MessageEventArgs>(ExampleServer_ReceivingRequest);

I am able to receive client request by this method and want to send a custom acknowledgement.

I am expecting acknowledgement in the client side by this method
client.Respond += new EventHandler(client_Respond);

Please suggest me, how do I execute above issue.

CoAP.net logging

Is there any available documentation on logging? All the flags seem to be set off by default. I am confused as to how to activate them. Does app config need to be modified?

Thanks,

David

PSK?

With Ikea Trådfri demanding the use of PSK, can someone point me in the right direction on how to use it with CoAP.NET?

Thanks! :)

MapToIPv4 fails for some IP Addresses

My IP of my host is: 10.0.2.181

This function is throwing an exception: (UDPChannel.cs)

    static IPAddress MapToIPv4(IPAddress address)
    {
        if (address.AddressFamily == AddressFamily.InterNetwork)
            return address;
        Byte[] bytes = address.GetAddressBytes();
        Int64 newAddress = (bytes[12] & 0xff) | (bytes[13] & 0xff) << 8 | (bytes[14] & 0xff) << 16 | (bytes[15] & 0xff) << 24;
        return new IPAddress(newAddress);
    }

The value for newAddress is being set to a negative number (I think because the last part of my IP is > 127. My fix was to change to:

    static IPAddress MapToIPv4(IPAddress address)
    {
        if (address.AddressFamily == AddressFamily.InterNetwork)
            return address;
        Byte[] bytes = address.GetAddressBytes();
        Byte[] array = new Byte[4];
        array[0] = bytes[12]; array[1] = bytes[13]; array[2] = bytes[14]; array[3] = bytes[15];
        return new IPAddress(array);
    }

COAP.net

Hi,
How we can provide the security in COAP.net DTLS based PSK,RPK and certificate security.

Thanks

GetNextResponseBlock() crashed if receiving a out-of-scope block number

Problem

There are not boundary checks in BlockwiseLayer.GetNextRequestBlock() and BlockwiseLayer.GetNextResponseBlock(). If a wrong block number arrives, the code may crash.

Solution

Check block range in GetNextResponseBlock().
Commit 4d8e0bf fixes this issue.

Backward compatibility

No backward compatibility problems are expected.

Test case:

Server

  • Example/CoAP.Server

Client

  • copper
  • GET /.well-known/core
  • block size 64
  • with "Block 2" in the Debug Control area set to a large number (i.e. 128 or above)

Result

System.OverflowException
    CoAP.Stack.BlockwiseLayer.GetNextResponseBlock(Response response, BlockwiseStatus status)
    CoAP.Stack.BlockwiseLayer.SendResponse(INextLayer nextLayer, Exchange exchange, Response response)

CoAP Client Request and Response

Hi,

In your example, we are using Http request response classes in Client.
How can we use CoAP specific request and response as System.Net is used in Message class inherited by (Coap.Request class).

Thanks
Ankush

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.