bash 在 Mac OS X 中访问 unix 域套接字

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4960593/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 23:26:11  来源:igfitidea点击:

Accessing a unix domain socket in Mac OS X

macosbashsocketsunixdns

提问by cyberguijarro

I'm trying to write (raw byte transfer, no fancy stuff) some data into a UNIX domain socket in Mac OS X (10.6) from the terminal (bash).

我正在尝试从终端 (bash) 将一些数据写入(原始字节传输,没有花哨的东西)到 Mac OS X (10.6) 中的 UNIX 域套接字中。

socat is not available and doesn not compile straight from source in OS X. According to google some versions of netcat support UDSs but neither of these do once compiled from source:

socat 不可用,也不能直接从 OS X 中的源代码编译。 据谷歌称,某些版本的 netcat 支持 UDS,但这些版本都没有从源代码编译过:

http://netcat.sourceforge.net/

http://netcat.sourceforge.net/

http://nc110.sourceforge.net/

http://nc110.sourceforge.net/

Any ideas?

有任何想法吗?

回答by ephemient

OpenBSD's ncsupports -Uto connect to UNIX-domain sockets, and should be reasonably portable. Source is in cvs(see anoncvs access), and Debian has some tarballs.

OpenBSD 的nc支持-U连接到 UNIX 域套接字,并且应该具有合理的可移植性。源在cvs(请参阅anoncvs access),Debian 有一些tarball

回答by maccie

A port of OpenBSD's enhanced version of netcat for Darwin can be found at:

可以在以下位置找到 OpenBSD 的针对 Darwin 的增强版 netcat 的端口:

http://slagheap.net/darwin/

http://slagheap.net/darwin/