Questions tagged [socket]

is a data communications endpoint for exchanging data between processes executing within the same host operating system.

Filter by
Sorted by
Tagged with
1
vote
1answer
19 views

How to use socat to implement a base64 decoding proxy?

The goal: bidirectional communication while decode in a unidirectional way the incoming data Theory: suppose to have a proxy/ server that listens on port 8080 which needs to handle multiple clients at ...
1
vote
1answer
17 views

“Holding” a socket open too long causes a new one to spawn

I am connecting to a socket via nc -U: user@node:~$ sudo nc -U service\@name.18822.sock user@node:~$ xmpp.status user@node:~$ connected If I "hold" this connection open too long, it will ...
0
votes
0answers
12 views

netcat producing EINVAL when sending to UDP IPv6 multicast

I'm using netcat on Fedora to test an IPv6 UDP multi-cast address. The command is echo hi | nc -6 -u ff02::777:777:777 7777 netcat responds, "Invalid argument." Running strace yields ...
0
votes
0answers
22 views

Why Won't the OS remove an Abstract Socket?

I created a program that creates a child thread, and the parent communicates with the child by way of an abstract socket created through: SOCKET control_sd; int retCode; struct sockaddr_un controlAddr;...
0
votes
0answers
31 views

Custom linux driver for custom Layer 3 protocol

We're designing a custom communication using a custom physical layer which will be used in a cubesat and I'm looking on how to create the custom layer 3 driver for linux (like ipv4 but not, the ...
0
votes
1answer
49 views

How to restrict the access/activation times for a service/socket with systemd?

I have a simple systemd service that is activated by system socket. It's as simple as that (a little simplified): $ systemctl cat example.socket # /usr/lib/systemd/system/example.socket [Unit] ...
1
vote
1answer
40 views

Kernel: Intercept listen call with module

I am writing an application that will detect any application calling listen(2) to open a socket for incoming connections and look up with a table of rules. It is much like ApplicationFirewall in macOS....
3
votes
1answer
89 views

Possible scenarios for Unix domain sockets interruption

When using TCP & UDP sockets, there are many scenarios which cause connection interruption (slow connection, network reset, etc). Is there any possible situation which an unix domain socket ...
0
votes
0answers
52 views

Npm won't install SOCKET.io due to Node version?

I need to install socket.io for my node program. So, whenever I try to install socket.io by running the following commandline instruction, it says node version needs to be greater than or equal to 10 ...
3
votes
1answer
43 views

How to find applications/ports that do bind() but don't do listen()?

When a faulty application calls bind() with a TCP socket to a port P but does not follow with listen(), the port P is not listed among open ports, i.e. netstat or ss or ls /proc/net/tcp do not show it,...
0
votes
1answer
25 views

How does buffering for TCP packets work?

If I write a few times in a quick succession on a socket (with the POSIX function write), usually all the data I wrote gets sent in a single TCP packets. Unless I write too much or unless I wait too ...
0
votes
1answer
97 views

proFTPD not working due to socket bind error

I am trying to set up an FTP server on one of my devices that runs DietPi and I selected proFTPD as a server. I have installed the software and followed some set-up information I found here. But then ...
0
votes
1answer
37 views

What would be a trivial or simple Time-of-check to time-of-use scenario in Bash?

Often when software development concepts are explained in Bash, I understand them better than say in JavaScript. About Time-of-check to time-of-use (TOCTOU) it was stated in the current opening ...
1
vote
0answers
81 views

socat bidrectionally with a shell script. echo, read, then hand off to socat

There is a VMM which doesn't conform to the the standard VSOCK implementation: Firecracker For each guest it creates a v.sock unix socket file The ordinary VSOCK-CONNECT:cid:1234 then becomes: UNIX-...
0
votes
1answer
3k views

nmap: Couldn't open a raw socket. Error: Permission denied (13)

I'm attempting to run the following command on an Ubuntu box (ssh from Windows 10 PowerShell): sudo nmap -sU -O localhost Starting Nmap 7.91 ( https://nmap.org ) at 2021-03-02 10:13 GMT Couldn't open ...
0
votes
1answer
61 views

How to get actual client IP using C in linux systems instead of localhost address

I am trying to read IP address in ubuntu system using C code #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include &...
0
votes
0answers
166 views

How to “cat” a socket?

So to read and write to a socket: Write to a socket: echo "hello" > /dev/tcp/192.168.0.144/27002 Read from socket: netcat -p 27002 -l BUT... I would like to read a socket using "...
0
votes
1answer
112 views

Which thread receives SIGURG?

I recently wrote a "study note" about Unix, and I made following proposition about multi-threaded processes: it will be almost impossible for the kernel to identify the thread that should ...
0
votes
0answers
149 views

Unlinking stale socket supervisor.sock

I have installed supervisor on a shared Debian server. My configuration looks like this: [unix_http_server] file=/tmp/supervisor.sock But when I start supervisor like this: supervisord -c supervisord....
2
votes
0answers
71 views

AF_UNIX: Using recv() to receive a message sent with sendmsg()

The function prototype for the sendmsg() function is as follows: ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags); and the msghdr struct is such: struct msghdr { void *...
0
votes
0answers
43 views

I have a `raspivid` stream, which I'm piping to `ffmpeg`, now i'd like to also stream a raw version of it to a socket?

I have a process outputing an MJPEG video stream, which I pipe into ffmpeg to reduce framerate and then to a socket. raspivid -t 999999 -cd MJPEG -w 1920 -h 1080 -o - | ffmpeg -i - -f mjpeg -r 2 - | ...
0
votes
0answers
19 views

What is the maximum idle cpu wakeup time tolerated by socket clients?

1 Summary An application process main thread is running an endless loop waiting for client requests over socket and sleeping in between. (This is comparable to an idle cpu waiting for a wake-up irq.) ...
0
votes
0answers
196 views

UNIX socket via TCP with socat - reconnect issue

I have two applications, a web-frontend and a backend, which run different containers. They normally communicate via a UNIX socket. I have created a bridge over TCP between with the help of socat. ...
1
vote
0answers
47 views

How to create a collecting socket relay with socat?

I'm using socat to forward to another port on localhost: socat tcp-l:5050,fork,reuseaddr tcp:localhost:2020 Problem: if the program running on 2020 is down, socat will answer incoming connections like:...
1
vote
1answer
19 views

Why is the socket number incremented by one in libssh2 x11 forwarding example?

I am looking to x11 forwarding example in libssh2 source (example/x11.c). In the function x11_send_receive I see this code: rc = select(sock + 1, &set, NULL, NULL, &timeval_out); if(rc > 0) ...
1
vote
1answer
124 views

Calculate TCP memory usage (does not add up)

I am running a Debian GNU/Linux 9.5 (stretch) with kernel: 4.9.0-7-amd64. I have found the culprit of a memory consumption problem I am facing to be an in-app mechanism for sending logs to FluentD ...
0
votes
2answers
432 views

where can I find socket files? ( I want unlink it and remove it..)

I'm doing debugging for a program that uses UDP socket. The program creates a socket but after that due to some other problems the program gets stuck and I cannot kill it properly. So I close the ...
0
votes
1answer
415 views

How is “multiple file descriptors refer to the same socket” created?

The Linux Programming Interface says 56.5.5 Connection Termination: close() The usual way of terminating a stream socket connection is to call close(). If multiple file descriptors refer to the same ...
0
votes
0answers
115 views

Transform xinetd to systemd service

I'm trying to migrate old application written for xinetd to systemd service. The config I have is: service server_ipv6 { id = server_ipv6 type = UNLISTED flags = ...
0
votes
0answers
68 views

Getting Connection Refused Error while testing PyPi OCPP Cental System and Charge Point

Iam trying to simulate the central system and charge point of PyPi OCPP given in the following link https://pypi.org/project/ocpp/. Central system code runs without any error. but while compiling the ...
0
votes
1answer
48 views

Script does work properly right after the first run

I have a problem with running the same script right after its first run finished. The script looks like this: #!/bin/bash ./program1 & ./program2 & ./program3 wait Briefly, the inner three C+...
2
votes
1answer
309 views

What happens when two processes listen on the same Berkeley/Unix [file] socket?

What happens when I set up two processes to listen to the same Berkeley socket? Do messages get routed to both? Neither? One of the two? If so, how? Concretely, I can start two gunicorn processes with ...
0
votes
2answers
370 views

Does every socket have its own buffers to send/receive messages?

I'm developping a C application that make extensive use of sockets. My doubt is: Does every socket that I create have its own buffers to send and/or receive messages from other sockets? In other words,...
0
votes
0answers
13 views

Problems creating a socket with NUMA

Add a command in QEMU v5.1.0 from the console to create a socket, I make it and even in properties it says it is a socket, without size, without problems, but now I am trying to do the same but, with ...
2
votes
0answers
244 views

How to get unix socket inode given its path?

Let /var/run/mysqld/mysqld.sock/ be an open socket. I can stat it to get inode of the file (here 1200) # stat /var/run/mysqld/mysqld.sock File: /var/run/mysqld/mysqld.sock Size: 0 ...
1
vote
1answer
156 views

Is there any authoritative place that says multi processes or threads accepting a listening socket is an atomic operation?

When I was reading some materials about Nginx, I noticed that one of the 2 traditional ways to accept incoming connections on a single socket is : The second of the traditional approaches used by ...
3
votes
1answer
305 views

What's the meaning of [socket:number] in /proc/pid/fd

UNIX domain sockets opened by given $PID are listed in /proc/$PID/fd/X as symlinks to [socket:ID]. I understand that it's an identifier of that socket, but what exactly is it? Is it an inode in sockfs?...
0
votes
1answer
86 views

what will happen if receiver unable to handle data velocity through socket?

I have two processes P1 (sender) and P2 (receiver). P1 uses unix-domain-socket (UDS) to send data to P2. what will happen if P1 sends data at the rate of 100 messages/second and P2 is capable to ...
0
votes
0answers
222 views

ss showing socket stuck in SYN-SENT with no traceable PID

On a client I see the following: [root@redacted_local ~]# ss | grep -i syn SYN-SENT 0 1 redacted_local_ip:792 redacted_server_ip:nfs ...
0
votes
0answers
19 views

How does kernel handle previous incoming data packets after a timeout has occurred

During a TCP request hand-shake a socket at both the end of the request is created i.e. the sender creates it during the SYN and receiver creates it on ACK. This is required for connection ...
0
votes
1answer
80 views

Are socketpairs useable as signal-safe buffers?

I am thinking on a way of communication between signal handlers and the main program. Note, I use mosly non-blocking signals (a new signal can arrive even while a signal handler is executed), so I am ...
0
votes
2answers
754 views

Mariadb on Raspbian: Can't connect to local MySQL server through socket

I'm setting up a "clean" image for my home Raspberry pi running the latest Raspbian, and I'm finding a small problem when installing the mariadb database. So far, the steps I've taken are ...
1
vote
0answers
150 views

How to monitor a UDP specific port/socket?

I have an application that receives UDP packets at port 5000. In order to be 100% sure that the application is receiving all packets (for example the RX buffer could be full and some packets could be ...
0
votes
1answer
159 views

How to determine active/passive end of TCP connection

If I inspect information about established TCP connections as returned by sock_diag(7) (or in /proc/net/tcp), how can I determine whether a given connection originated with the local side owning the ...
1
vote
1answer
71 views

How to make ss show the user who is using the socket?

I want to know which user launched the process that is using a TCP socket. I tried with ss -nte, but it only shows the uid, not the user's name. Is there a way to make ss show the user's name? Here ...
0
votes
0answers
161 views

Set can baudrate with ioctl or similar from C/C++

I'm currently setting the baudrate of my can0 with ip link: /sbin/ip link set can0 up type can bitrate 250000 I'm just wondering how to do the same from within C/C++?
3
votes
1answer
324 views

What could cause AF_NETLINK socket transactions to take many seconds?

My problem AF_NETLINK queries to the kernel intermittently take many seconds before being answered, for example in this strace trace: 10:42:38.864353 socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, ...
0
votes
2answers
307 views

Can't open socket im systemd service

I have a software written in C language which opens a UDP socket to my server through internet. I use a systemd service approach to run the code at startup. It works fine. But in some cases which I ...
0
votes
1answer
203 views

How can I use socketpair to have two way communication between applications?

How can I use socketpair (C++ Linux) to have two way communication between (two) applications? Both applications will run on same hardware, hence I am looking for implementation of socketpair on same ...
1
vote
2answers
202 views

How does the TCP/IP protocol differentiate between clients?

If we create a listening socket it will return us a descriptor (let say root descriptor) and we are binding this descriptor to a address. Whenever a new client connection is available the root ...

1
2 3 4 5
7