question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UnixServer example doesn't work on Mac with either nc or socat

See original GitHub issue

I’m trying to make a server using the UnixServer example as a starting point. On my Mac, when I send more than two buffers worth to it, it just hangs and no longer reads more data. Here are two example commands that should work (and do work on Linux).

➜ ~ cat .emacs | socat UNIX-CONNECT:/tmp/fubar.sock - ➜ ~ cat .emacs | nc -U /tmp/fubar.sock

All I’m doing is running the UnixServer class straight out of the box. I’m using version jnr-unixsocket 0.28.

The funny thing is that if I make the ByteBuffer smaller than 1024 (like 512), it hangs after just 1 buffer read. All buffer sizes work fine on Linux.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
headiuscommented, Mar 18, 2020

With the UnixServer working properly now on Darwin, I’m going to close this issue.

From discussions and articles online, it appears this may be just one of the “quirks” of using poll across platforms. It does not appear that additional POLL_IN events get triggered for unread data that happens to be lying around in a kernel buffer, so code that responds to a READ select should attempt to read as much data as is available before doing another select.

0reactions
headiuscommented, Apr 22, 2020

Releasing today in 0.29.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Netcat on Mac OS X - Super User
Install using Homebrew: brew install netcat · One can use either the nc or netcat command. nc is an alias for netcat ....
Read more >
If Safari on Mac doesn't open a webpage or isn't working as ...
To find out whether the issue is with your network itself, try viewing the website after connecting to a different network. Resolve other...
Read more >
How can I communicate with a Unix domain socket via the ...
Example command: nc -U /var/run/socket ... it may look like it doesn't support unix domain sockets (the -U option doesn't exist) but I...
Read more >
1. Getting Started - Learning Unix for Mac OS X, Second ...
Working in the Unix Environment. To get into the Unix environment, launch the Terminal application. (That's Finder → Applications → Utilities → ...
Read more >
How to make an Echo server with Bash? - tcp - Stack Overflow
If you use ncat instead of nc your command line works fine with multiple connections but (as you ... In case ncat is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found