Coder Social home page Coder Social logo

Socket not connected error about go-coap HOT 3 CLOSED

plgd-dev avatar plgd-dev commented on June 22, 2024
Socket not connected error

from go-coap.

Comments (3)

gh0st42 avatar gh0st42 commented on June 22, 2024

Oh, the successful connections were made using this: https://github.com/eclipse/californium.tools/tree/master/cf-browser

from go-coap.

jkralik avatar jkralik commented on June 22, 2024

I created branch https://github.com/go-ocf/go-coap/tree/californium where I added tests for californium: californium_test.go.

For TCP:
go-coap has disabled blockwise by default for tcp connection - to enable it, you need to set client.BlockWiseTransfer to true.

example code:

  californiumServer = "californium.eclipse.org:5683"
  enable := true
  client := &Client{Net: "tcp", BlockWiseTransfer: &enable}`
  co, err := client.Dial(californiumServer)
  if err != nil {
	t.Fatalf("Error dialing: %v", err)
  }

  resp, err := co.Get("")
  if err != nil {
    t.Fatalf("Cannot post exchange")
  }

For UDP:
On Windows/Linux it is works. I dont' have MacOS to solve issue - it seems problem is in udp.go:WriteToSessionUDP -> If you replace line 62 in udp.go:
n, _, err := conn.WriteMsgUDP(b, correctSource(session.context), nil)
by
return conn.WriteToUDP(b, session.raddr)
is it helps you?

from go-coap.

jkralik avatar jkralik commented on June 22, 2024

I will close this issue. If you have still problem reopen it. Thx

from go-coap.

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.