Giter Site home page Giter Site logo

Comments (5)

longshine avatar longshine commented on July 28, 2024

Hi~

It seems there might be something incorrect with the IPv6 network interface on your OS.

The log says:

DEBUG - Starting CoAP server
Warn - Cannot start endpoint at :::5683
DEBUG - Stopping endpoint bound to :::5683
Warn - Could not start endpoint :::5683
System.Net.Sockets.SocketException: The descriptor is not a socket

The server tries to bind a socket to an IPv6 address of [::] (System.Net.IPAddress.IPv6Any) and fails.

Please try adding the following code before starting a server:

server.AddEndPoint(IPAddress.Any, server.Config.DefaultPort);

It will bind to the IPv4 address (0.0.0.0), instead of the default IPv6 address.
You can use any other network address on your OS if you'd like to.

from coap.net.

lzheng5 avatar lzheng5 commented on July 28, 2024

Hi, longshine

I have tried your suggestion. It still has problem with binding.

Here is the error message.

Warn - Cannot start endpoint at 0.0.0.0:5683
DEBUG - Stopping endpoint bound to 0.0.0.0:5683
Warn - Could not start endpoint 0.0.0.0:5683
System.Net.Sockets.SocketException: The descriptor is not a socket
  at System.Net.Sockets.Socket.IOControl (Int32 ioctl_code, System.Byte[] in_value, System.Byte[] out_value) [0x00033] in /build/mono/src/mono-4.4.0/mcs/class/System/System.Net.Sockets/Socket.cs:3219 
  at CoAP.Channel.UDPChannel.SetupUDPSocket (AddressFamily addressFamily, Int32 bufferSize) [0x00009] in <filename unknown>:0 
  at CoAP.Channel.UDPChannel.Start () [0x00117] in <filename unknown>:0 
  at CoAP.Net.CoAPEndPoint.Start () [0x00040] in <filename unknown>:0 

It can not even bind to ipv4 localhost.

The only distinction my server program has is that I have not added all the resources but HelloworldResource only. But I think this shall not affect the binding, right?

In order to rule out the possibility that my system has some problem, I have compiled a C program, and server can bind correctly.

Thanks,

from coap.net.

longshine avatar longshine commented on July 28, 2024

Hi~

That's very odd. I googled and found some other projects have the same issue too, but no solution. See rabbitmq-dotnet-client and sockets-for-pcl.

CoAP resources should have nothing to do with this issue.

I found some messages in the log:

  at System.Net.Sockets.Socket.IOControl (Int32 ioctl_code, System.Byte[] in_value, System.Byte[] out_value) [0x00033] in /build/mono/src/mono-4.4.0/mcs/class/System/System.Net.Sockets/Socket.cs:3219 
  at CoAP.Channel.UDPChannel.SetupUDPSocket (AddressFamily addressFamily, Int32 bufferSize) [0x00009] in <filename unknown>:0 

There are some preparation steps when setting up a UDP socket in UDPChannel.SetupUDPSocket(), which might not be well supported on Mono.
I will make a patch later. Are you using the binaries or the source codes?

from coap.net.

longshine avatar longshine commented on July 28, 2024

Fixed in commit 7ffdb94.

from coap.net.

lzheng5 avatar lzheng5 commented on July 28, 2024

Hi, longshine

This bug has been resolved.

I can get the following result.

DEBUG - Starting endpoint bound to 0.0.0.0:5683
CoAP server [RFC 7252] is listening on 0.0.0.0:5683

Even if server.AddEndPoint(IPAddress.Any,server.Config.DefaultPort); is commented out.

Thanks,

from coap.net.

Related Issues (20)

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.