Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server working when testing from host on macOS #1

Open
beriberikix opened this issue Mar 31, 2019 · 7 comments
Open

Server working when testing from host on macOS #1

beriberikix opened this issue Mar 31, 2019 · 7 comments

Comments

@beriberikix
Copy link

The main goal of this fork is to make the libcoap-minimal work in a Docker container.

Everything is building correctly and I can verify server by logging into the container and running coap-client coap://127.0.0.1/hello - it should return world. When I run coap-client on my mac, it just hangs. I can verify the the request is going through by using coap-client -v 9 and the NET I/O from docker stats.

With my limited experience in docker networking, I'm not sure what's going wrong. One theory is how CMD or or ENTRYPOINT may be used?

@tiborvass
Copy link

@beriberikix can you provide the exact commands to reproduce ?

@beriberikix
Copy link
Author

Sure! I'm using VSC, so some of these commands are generated by the GUI.

docker build --rm -f "Dockerfile" -t coapserver:v1 .
docker run --rm -d -p 5683:5683/udp coapserver:v1
docker exec -it 4757d733c328dcb1eca1734abf4cbb6d8c20aec480f8c778561dff073091ffc6 /bin/sh -c "[ -e /bin/bash ] && /bin/bash ||

// in the container
/ # coap-client coap://127.0.0.1/hello
world

// on macOS host
coap-client -v 9 coap://127.0.0.1/hello
docker stats

If you don't want to hassle with building coap-client on your local machine, there's a simpler coap-cli written in Node.js that should be interchangeable for this test.

npm install coap-cli -g
coap get coap://127.0.0.1/hello

@tiborvass
Copy link

It looks like this is a Docker for Mac issue with UDP. I reproduced with a simple netcat.

@tiborvass
Copy link

I opened docker/for-mac#3603

@beriberikix
Copy link
Author

I replied on the Docker/for-mac ticket but netcat for UDP works just fine, so it must be something with the server.

@tiborvass
Copy link

tiborvass commented May 6, 2019

Ugh, I just realized I had this tab open with the following unsent comment:

@beriberikix try changing localhost to 127.0.0.1 in https://github.com/coapcloud/libcoap-minimal/blob/master/server.cc#L26

And I just saw that you did precisely that in d85ada6
Does it mean it's fixed?

@beriberikix
Copy link
Author

Unfortunately not :(. It was a red herring on my local development machine. I'm hoping to hear from the libcoap maintainer over at obgm/issues/3 to see if there's anything that might be the issue in the server implementation.

I should probably roll back that commit 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants