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
0
votes
1answer
55 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
1answer
20 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
61 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 "...
1
vote
1answer
1k views

Detecting where to bind to receive a UDP broadcast

I'm writing an application that needs to capture and print UDP broadcasts. The network interface in use is: enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.10....
0
votes
0answers
21 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
26 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
16 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 - | ...
11
votes
2answers
17k views

How to automatically create a runtime folder with a systemd service or tmpfiles.d?

I'm trying to create a runtime folder at /run/gunicorn for some Gunicorn socket / PID files, which are for a Django application. I can get everything working if I manually create directories. However, ...
0
votes
0answers
13 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.) ...
-1
votes
0answers
22 views

Why I can't read from and write to socket with printf and scanf? [migrated]

I wonder why this code is not working. I mean: When both the server and client are running I can type and type with no result. However, when I kill the client, the server starts outputting everything ...
0
votes
0answers
25 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
11 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:...
7
votes
7answers
34k views

Installing vsftpd - 500 OOPS: could not bind listening IPv4 socket?

I have to set up a FTP server on my machine. I have installed vsftpd using the command: sudo apt-get install vsftpd I then edited the configuration file vsftpd.conf in the location /etc. The file ...
1
vote
1answer
58 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 ...
2
votes
2answers
3k views

How can I verify that the port forwarding is established by checking the sockets?

After I run $ ssh -L 9000:google.com:80 testme@localhost how can I verify that the port forwarding is established by checking the sockets (internet and unix domain sockets)? Thanks.
1
vote
1answer
16 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) ...
3
votes
1answer
2k views

What is the difference between /etc/group and /etc/subgid?

I am in a Docker context and i am using user namespaces to map my container's user into my host's user (let's say foo). As i use portainer (As a container), i need to bind the Docker socket. $ll /var/...
0
votes
1answer
152 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
2answers
115 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
0answers
34 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
25 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 ...
1
vote
1answer
2k views

Udev rule setting up SocketCAN socket only works correctly only when run manually

I want to start slcand (the userspace daemon for the serial line CAN interface driver) when my Lawicel CanUSB dongle is plugged in. I followed Pascal Walter's step-by-step guide and all seems to work (...
0
votes
1answer
43 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+...
1
vote
1answer
112 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 ...
64
votes
6answers
51k views

What is a socket?

Could someone explain to me what a socket is? I see it in many acronyms in context of SSL, etc. Also, why is it called a socket? Is it purely because it was what a name they invented? Or was it the ...
5
votes
1answer
1k views

Scripted write-then-read from Unix domain socket using socat

I have a simple server listening on a Unix domain socket (on a CentOS box in case that's important). When I send the command "DATE" to the socket it writes back a welcome message and then "APRIL 15 ...
0
votes
2answers
109 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,...
64
votes
8answers
41k views

Who's got the other end of this unix socketpair?

I want to determine which process has the other end of a UNIX socket. Specifically, I'm asking about one that was created with socketpair(), though the problem is the same for any UNIX socket. I ...
0
votes
0answers
11 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 ...
1
vote
1answer
1k views

Whose `I-Node` does `netstat -ap` for unix domain sockets refer to?

What does I-Node mean in the output of netstat -ap for unix domain sockets? It seems not the same as the inode of the socket file: $ netstat -ap ... Active UNIX domain sockets (servers and ...
2
votes
0answers
103 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
83 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
108 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
2answers
48 views

Manually stopped service is not properly stopped

I have a Server, that is supposed to activate if someone tries to connect to it. For this I created a systemd socket and service that builds a proxy for my server and starts it. Thanks to this ...
3
votes
1answer
1k views

How do I make systemd sockets close when service is stopped?

I'm currently trying to make a systemd service with two Fifo sockets. These sockets map to stdout and stdin of the application. I'm currently using the following configuration files. foo.service [...
0
votes
1answer
42 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
100 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
16 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
59 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 ...
2
votes
1answer
2k views

cannot start chrome browser - bind failed: Permission denied

I am using grsecurity kernel with CONFIG_GRKERNSEC_SOCKET_SERVER enabled: [*] Socket restrictions [ ] Deny any sockets to group (NEW) [ ] Deny client sockets to group (NEW) [*] Deny ...
0
votes
1answer
433 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 ...
0
votes
0answers
6 views

How to manage the message rate for the SocketCAN API?

I would like to ensure that my CAN messages are being sent at a rate between 50 and 100Hz. I am also not sure how I would calculate that... I was looking at what the Broadcast Manager does in the ...
0
votes
1answer
87 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
0answers
110 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 ...
6
votes
1answer
29k views

Error starting docker service: Unit not found

I am working with a Redhat 7.4, this machine doesn't have internet connection, and I want to install Docker, therefore I downloaded a rpm package, this one: docker-ce-selinux-17.03.0.ce-1.el7....
0
votes
1answer
92 views

Get Originating device(physical device) info for Packets trapped on Bridge

Lets assume below given is the set of net devices that my frame is intended to traverse over. eth0(1) -> bond0(2) -> bridge(3) -> vlan100(4). >>> (number) is the ifindex for each netdevice I have ...
0
votes
2answers
197 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 ...
3
votes
1answer
154 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, ...
1
vote
1answer
57 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
68 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++?

1
2 3 4 5
7