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
0 answers
22 views

XDMCP locally using Unix sockets

Is there any way to start a XDMCP session, say with Xephyr in LightDM, locally through Unix Sockets instead of IP? For performance I was wondering if, somehow, I can avoid any network stack working ...
user avatar
1 vote
1 answer
13 views

websocat / wscat save a new file per seconds

This question is about saving a wss:// stream into multiple files... while execution (NOT AFTER) EXAMPLE : websocat "wss://stream.binance.com:9443/ws/btcusdt@depth" > /path/$(date +%s)....
user avatar
  • 115
0 votes
2 answers
17 views

systemd service file closing socket

I need to run a C++ binary with systemd. When I execute the binary directly or with a bash script it runs fine for days: nohup ./testbinary & ./test.sh test.sh: #!/bin/bash LD_LIBRARY_PATH="...
user avatar
4 votes
1 answer
2k views

Why is zsh listening on port 22?

I'm SSH'ed into a virtual machine and looking at /proc/<pid>/net/tcp for my zsh shell. I see this line sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid ...
user avatar
0 votes
2 answers
36 views

What is the difference between 0.0.0.0:99 and [::]:99?

My ss -lt shows these lines LISTEN 0 4096 127.0.0.53%lo:domain 0.0.0.0:* ...
user avatar
0 votes
0 answers
31 views

Program cannot acquire the capabilities it needs (raw sockets)

Note: This is partly a programming question, but my gut feeling is that this has more to do with the Linux' security capabilities framework in general, hence posting here instead of StackOverflow. I ...
user avatar
  • 101
0 votes
0 answers
8 views

Resource exhaustion with systemd socket-activated service

I recently set up a new service with systemd having the following configuration: # myservice@.service [Unit] Description=My Service [Service] Type=simple RemainAfterExit=yes ExecStart=/usr/local/bin/...
user avatar
4 votes
1 answer
63 views

What does SCM mean in unix sockets context (SCM_RIGHTS etc.)?

From man 7 unix SCM_RIGHTS Send or receive a set of open file descriptors from another process. The data portion contains an integer array of the file descriptors. The passed file descriptors ...
user avatar
0 votes
0 answers
26 views

Clear socket buffer of CAN adapter

I have a USB/CAN adapter, from lsusb: OpenMoko, Inc. Geschwister Schneider CAN adapter it provides a socket interface, from ip addr: 5: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast ...
user avatar
  • 557
0 votes
0 answers
47 views

Netlink socket send hangs when using SCHED_FIFO and Gtk3 filechoosers

I am seeing a problem where if I create a thread which utilizes 100% of a CPU core while being in SCHED_FIFO, and then I open any application that instantiates a Gtk3 file chooser, then any ...
user avatar
  • 41
3 votes
0 answers
116 views

IPTables log connection pid on OUTPUT chain

I'm trying to find pid of a socket using iptables OUTPUT chain log, or even better adding it into the log. My current iptable rule: sudo iptables -A OUTPUT -j LOG --log-prefix='[PID]' --log-level 7 --...
user avatar
0 votes
1 answer
33 views

Programmatically ascertain aspects of socket file

I'm trying to write a program (in C) which, as one of its features, walks the procfs to find open sockets and ascertain things like the destination/source ports/addresses (similar to what netstat and ...
user avatar
0 votes
0 answers
31 views

How can I guess server socket type

I try to connect to my UNIX-socket server using openbsd-netcat, but have an error: connect(): Protocol wrong type for socket My socket type is SOCK_SEQPACKET, and it seems that nc tries to open it as ...
user avatar
  • 1,223
0 votes
3 answers
27 views

Why am I hitting file number limit prematurely?

A custom application running on one of our development systems (Ubuntu 21.10 Desktop) is bombing out with the error socket: Too many open files. So I immediately checked the limits. Here's the output: ...
user avatar
2 votes
1 answer
88 views

Why does socat fail at proxying X11 where ssh succeeds?

I am investigating how to write a simple X11 unix-socket-based proxy. I have tried various standard applications, as well as written my own code, but I am getting wildly variable results. What's ...
user avatar
  • 233
0 votes
2 answers
233 views

How to receive a file and save it with socat

**** This is for learning purpose. I just like to deep dive into sockets, tcp, packets, etc. For doing tests and learning, I began to "play" with socat CONTEXT (tests) : 1- Bind a port to a ...
user avatar
  • 105
2 votes
1 answer
206 views

Is it possible to access a Unix socket over the network?

The documentation of the Linux sandboxing application firejail says whenever we are dealing with X11 we also need to install a new network namespace. This is the only way to block access to the ...
user avatar
  • 233
0 votes
1 answer
58 views

What happens to sockets when a process dies to segfault?

Imagine I have a server that has a connected tcp socket with a remote client. If the server dies because of a segfault, will the socket be closed by the OS and the client be notified with a RST or ...
user avatar
  • 147
0 votes
1 answer
56 views

Finding details of open socket

My program is leaving TCP sockets open, and I'm trying to trace the cause (I use a number of different sockets). The lsof commands shows: myprog 258981 root 56u sock 0,8 ...
user avatar
  • 1,312
0 votes
0 answers
22 views

EADDRNOTAVAIL when dropping IGMPv2 membership and forcefully sending rejoins on interval

I have a case where I want to send a IGMP membership report every N interval. Currently I have one socket that uses setsockopt to join and maintain that membership via the kernel. I have also set up ...
user avatar
0 votes
1 answer
40 views

Can I use ss and filter on PID and FD?

I'd like to be able to run ss and filter on PID=$(pgrep emacs) and FDs=(5u|6u|8u). Does ss support filtering on either (or both) of these? Or is the best option to compose with grep? I'm currently ...
user avatar
  • 101
0 votes
1 answer
767 views

unix domain socket permissions and umask integration between root and non root users

I'm trying to understand the permissions of a unix domain socket, when using an existing file, umask changes are required as well as the dir permissions. If I create a world readable dir as root and ...
user avatar
-2 votes
1 answer
50 views

How to get open connections statistics without ss or netstat

The question may sound silly but I'm trying to make a tool that uses ss data. Sadly I'm having some troubles regarding output format parsing (too much randomness depending on version and system). So, ...
user avatar
1 vote
0 answers
76 views

How to listen the requests sent to a unix socket

I'm learning docker and wanted to see the API commands sent by the client to the docker server/engine. I know that the communication between the two processes happens via /var/run/docker.sock. Is ...
user avatar
0 votes
1 answer
58 views

Is socket sys (libc) function supposed to always return the same result for the same parameters?

I am writing a C# app that basically does a similar job that iwlist. I am having trouble, though, in porting the IOCTL calls into .NET. I mean, the interop code I have written so far (to enable my ....
user avatar
  • 298
0 votes
0 answers
31 views

does socket buffer occupy process memory address?

As we know, we can use setsocketopt api to alter the socket's buffer size. Since the socket fd is created by user process, does it occupy process memory address, like the top 1G kernal space in each ...
user avatar
  • 115
0 votes
0 answers
205 views

How to use socat to implement a proxy?

The goal: bidirectional communication while decoding the incoming rot13 data and encoding it back Theory: suppose to have a proxy/ server that listens on port 8080 which needs to handle multiple ...
user avatar
  • 21
0 votes
1 answer
55 views

listener message on port 23

I want to have a message to anyone that tries to telnet (port 23) to my server that they are connecting to the wrong port, then disconnects them. Basically something like socat would be ideal, but I ...
user avatar
1 vote
1 answer
201 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 ...
user avatar
  • 21
0 votes
1 answer
33 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 ...
user avatar
  • 1,490
1 vote
1 answer
249 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 ...
user avatar
0 votes
0 answers
68 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;...
user avatar
  • 1
0 votes
0 answers
120 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 ...
user avatar
  • 1
0 votes
1 answer
198 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] ...
user avatar
  • 2,136
0 votes
1 answer
69 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....
user avatar
  • 11
3 votes
1 answer
291 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 ...
user avatar
  • 83
0 votes
0 answers
109 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 ...
user avatar
  • 133
3 votes
1 answer
280 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,...
user avatar
  • 133
0 votes
1 answer
167 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 ...
user avatar
0 votes
1 answer
551 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 ...
user avatar
  • 216
0 votes
1 answer
74 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 ...
user avatar
1 vote
0 answers
141 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-...
user avatar
0 votes
1 answer
6k 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 ...
user avatar
  • 339
0 votes
1 answer
122 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 &...
user avatar
  • 1
0 votes
0 answers
824 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 "...
user avatar
  • 765
0 votes
1 answer
297 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 ...
user avatar
  • 429
5 votes
0 answers
227 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 *...
user avatar
  • 419
0 votes
0 answers
100 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 - | ...
user avatar
1 vote
0 answers
223 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:...
user avatar
1 vote
1 answer
25 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) ...
user avatar
  • 113

1
2 3 4 5
8