Questions tagged [socketpair]
23 questions
3
votes
1 answer
Is write to SOCK_SEQPACKET atomic?
What I mean atomic is success or failed and do nothing.
I know socketpair(AF_LOCAL, SOCK_STREAM) is not atomic, if multiple processes/threads call write(fd, buf, len), the return value of the write() maybe > 0 && < len and cause data out of…

alpha
- 1,228
- 1
- 11
- 26
3
votes
1 answer
Behavior of SO_SNDBUF when using socketpair
I want to send messages between two threads using socketpair.
I am writing code to find out how many messages can be send using a socketpair, with message of size 16 bytes ( two pointers ). The code I used is below:
int fds[2];
socketpair(AF_LOCAL,…

Manu Thomas Mathew
- 101
- 1
- 6
2
votes
0 answers
Delay in read/write pipe when many requests for unix pipe (sockerpair) communication in Golang
I have a performance problem with sockerpair in Golang (also known as unix pipe inter-process communication).
The delay would be very long, if there are many requests issued to pipe. One process sends out about 10K requests; and then the reader…

JQian
- 226
- 2
- 9
1
vote
1 answer
Why can't I communicate with a forked child process using Tokio UnixStream?
I'm trying to get a parent process and a child process to communicate with each other using a tokio::net::UnixStream. For some reason the child is unable to read whatever the parent writes to the socket, and presumably the other way around.
The…

cdecker
- 4,515
- 8
- 46
- 75
1
vote
2 answers
socketpair() & creating new child processes after close() of worker socket
First off: this is not a Unix/Linux system. I am working on an IBM AS/400 V7R1 (C++ 98) and do not have access to fork(). Nevertheless, I do have spawnp() to start new child processes and the AS/400 supports the notion of process groups.
In my…

Kelly Beard
- 684
- 1
- 8
- 20
1
vote
1 answer
Using socketpair() under Rust
How can you call Linux' socketpair() command in rust?
I was not able to find it in the documentation.

user3272410
- 33
- 4
1
vote
2 answers
ncurses interrupts system call when resizing terminal
I have a problem with ncurses and couldn't find a solution on the web, so I've written following little program to demonstrate the problem.
You can compile it via:
sudo aptitude install ncurses-dev
g++ -lncurses -o resize resize.cpp
It displays an…

user2876571
- 11
- 3
1
vote
1 answer
Perl select returning undef on sysread when using Windows, IPC::Open3, and IO::Socket->socketpair()
I found this example (posted by @ikegami) of a way to use IPC::Open3 on windows using sockets. The problem is that, when I run it, I get an error An existing connection was forcibly closed by the remote host on the sysread. The command runs, the…

Lucas
- 14,227
- 9
- 74
- 124
0
votes
0 answers
Error "failed to create socketpair" when run adb shell
I got an error when run adb command:
adb -s 127.0.0.1:21503 shell input swipe 1000 345 350 345 250
And the error:
error: failed to create socketpair to intercept data: Too many open files
It works fine at first, but after about 15 minutes this…
0
votes
1 answer
create socketpairs() for multiple forks() or just one is enough
I'm trying to make a program that does the following:
./run cmd1 arg1 : cmd2 arg2 : cmd3 arg3
allows me to run three commands for example in parallel using fork() and execvp and connecting the output of the cmd 1 to the input of the cmd 2 using…

asmazizou
- 101
- 8
0
votes
1 answer
permission denied calling socketpair() from kubernetes container
Trying to run some Python software in a docker container, I consistently get EPERM errors when creating a (abstract) unix domain socket using socket.socketpair():
% python3 -c 'import socket; socket.socketpair()'
Traceback (most recent call last):
…

jelmer
- 2,405
- 14
- 27
0
votes
0 answers
Is it possible that socketpair() return same pairs?
I understand that socketpair API can generate a pair of connected sockets. But is it true that socketpair() can generate two same pairs in the same process?
// In the same process
int fd[2];
int r = socketpair(AF_UNIX, SOCK_STREAM, 0,…

Alan
- 469
- 10
- 26
0
votes
1 answer
use dup2 to redirect printf failed
The code is following.
Q1:
If dup2(fd3, STDOUT_FILENO), string2 will be in log.txt.
If dup2(g_ctl[0], STDOUT_FILENO), string2 won't be received by g_ctl[1].
string1 and ls -al output will be received, Why ?
Q2:
The third library have some…

Kathy.Pu
- 97
- 6
0
votes
1 answer
C++ Socket Pair Not Reading/Writing Parent/Child
I've been assigned a project in which I need to use Unix Domain Sockets to communicate two-way between a parent and child process. My original approach was to create a child and server, but I was getting some serious issues with connectivity and…

Ainsley
- 33
- 9
0
votes
1 answer
Why does socketpair() allow SOCK_DGRAM type?
I've been learning about Linux socket programming recently, mostly from this site.
The site says that using the domain/type combination PF_LOCAL/SOCK_DGRAM...
Provides datagram services within the local host. Note that this
service is…

StoneThrow
- 5,314
- 4
- 44
- 86