unix-socket

TCP loopback connection vs Unix Domain Socket performance

£可爱£侵袭症+ 提交于 2019-11-30 06:09:27
问题 Working on an Android and iOS based application which require communication with a server running in the same device. Currently using TCP loopback connection for communicating with App and Server (App written in user layer, server written in C++ using Android NDK) I was wondering if replacing inter communication with Unix Domain socket would improve the performance? Or in-general is there any evidence/theory that proves that Unix Domain socket would give better performance then TCP loopback

Connecting to an already established UNIX socket with node.js?

放肆的年华 提交于 2019-11-30 03:50:06
问题 I am working on a node.js application that will connect to a UNIX socket (on a Linux machine) and facilitate communication between a web page and that socket. So far, I have been able to create socket and communicate back and forth with this code in my main app.js: var net = require('net'); var fs = require('fs'); var socketPath = '/tmp/mysocket'; fs.stat(socketPath, function(err) { if (!err) fs.unlinkSync(socketPath); var unixServer = net.createServer(function(localSerialConnection) {

Use Python xmlrpclib with unix domain sockets?

大憨熊 提交于 2019-11-30 02:21:00
问题 I'm trying to interact with supervisord , and I'd like to talk with it over a unix socket (it's a shared hosting environment). What I've tried so far is: import xmlrpclib server = xmlrpclib.ServerProxy('unix:///path/to/supervisor.sock/RPC2') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/xmlrpclib.py", line 1549, in __init__ raise IOError, "unsupported XML-RPC protocol" IOError: unsupported XML-RPC protocol /path/to/supervisor.sock

Buffering characteristics of Unix Sockets

我只是一个虾纸丫 提交于 2019-11-29 23:10:49
问题 Does anyone know the buffering characteristics of Unix sockets when sending small chunks of data(a few bytes)?, when using TCP sockets I can disable the Nagle algorithm to prevent latency in data transit but there's no equivalent functionality (that I know of) for Unix Domain sockets. Thanks. 回答1: There is no nagle algorithm available on unix domain sockets. Unix sockets are normally implemented as a memory buffer in the operating system kernel. Once you've written/sent data on the socket, it

htons() function in socket programing

跟風遠走 提交于 2019-11-29 19:32:42
I am new to socket programming and I am trying to understand the operation of htons() . I've read a few tutorials on the Internet like this and this one for instance. But I couldn't understand what htons() does exactly. I tried the following code: #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> int main( int argc, char *argv[] ) { int sockfd, newsockfd, portno, clilen; char buffer[256]; struct sockaddr_in serv_addr, cli_addr; int n; /* First call to socket() function */ sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) { perror("ERROR opening

erlang: UNIX domain socket support?

青春壹個敷衍的年華 提交于 2019-11-29 13:05:26
问题 Is there a way to access UNIX domain sockets (e.g. /var/run/dbus/system_bus_socket ) directly from Erlang without resorting to a third-party driver? 回答1: Erlang/OTP comes with drivers for tcp and udp sockets only. So... No. Third part drivers unixdom_drv in http://jungerl.sourceforge.net/ uds_dist in the source tree's driver examples procket at https://github.com/msantos/procket 回答2: In Erlang/OTP 19.0, UNIX Sockets are now available, as stated in the readme: OTP-13572 Application(s): erts,

Can docker port forward to a unix file socket on the host container?

自作多情 提交于 2019-11-29 11:06:13
问题 Running the following command fails: sudo docker run -p unix:///tmp/file.sock:44444 -d image_name Is something wrong with my port forwarding syntax or is a configuration like this not possible? 回答1: Docker's -p syntax won't take a unix socket: -p=[] : Publish a container᾿s port to the host (format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort) One solution would be to: Run your container without any -p specification, we'll name it "cont1" ( --name cont1 ) Run a

How to create Unix Domain Socket with a specific permissions in C?

女生的网名这么多〃 提交于 2019-11-29 05:08:29
问题 I have a simple code, like: sockaddr_un address; address.sun_family = AF_UNIX; strcpy(address.sun_path, path); unlink(path); int fd = socket(AF_UNIX, SOCK_STREAM, 0); bind(fd, (sockaddr*)(&address), sizeof(address)); listen(fd, 100); I want to atomically create the Unix Domain Socket file with a specific permissions, say: 0777 . The manual doesn't say anything about socket file permissions with regard to umask or whatever. Even, if the umask does affect the socket file, then it's not an

htons() function in socket programing

。_饼干妹妹 提交于 2019-11-28 15:09:32
问题 I am new to socket programming and I am trying to understand the operation of htons() . I've read a few tutorials on the Internet like this and this one for instance. But I couldn't understand what htons() does exactly. I tried the following code: #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> int main( int argc, char *argv[] ) { int sockfd, newsockfd, portno, clilen; char buffer[256]; struct sockaddr_in serv_addr, cli_addr; int n; /* First call to

TCP loopback connection vs Unix Domain Socket performance

喜欢而已 提交于 2019-11-28 15:08:00
Working on an Android and iOS based application which require communication with a server running in the same device. Currently using TCP loopback connection for communicating with App and Server (App written in user layer, server written in C++ using Android NDK) I was wondering if replacing inter communication with Unix Domain socket would improve the performance? Or in-general is there any evidence/theory that proves that Unix Domain socket would give better performance then TCP loopback connection? Yes, local interprocess communication by unix domain sockets should be faster than