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
164 votes
6 answers
282k views

How can I communicate with a Unix domain socket via the shell on Debian Squeeze?

I’m running a Debian Squeeze web server. I’ve installed memcached on it, and configured memcached to listen on a Unix domain socket (at /tmp/memcached.sock), as it only needs to receive messages from ...
Paul D. Waite's user avatar
82 votes
6 answers
69k 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 ...
chrisjlee's user avatar
  • 8,503
77 votes
1 answer
94k views

How do I find out more about socket files in /proc/fd?

Looking in /proc/$mypid/fd/, I see these files lrwx------ 1 cm_user cm_user 64 Oct 14 03:21 0 -> /dev/pts/36 (deleted) lrwx------ 1 cm_user cm_user 64 Oct 14 03:21 3 -> socket:[1424055856] lrwx-...
benhsu's user avatar
  • 925
76 votes
8 answers
53k 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 ...
Jonathon Reinhart's user avatar
63 votes
2 answers
48k views

Performance of unix sockets vs TCP ports

For example on php-fpm: #listen = 127.0.0.1:9000 listen = /var/run/php-fpm/php-fpm.sock Is there any major performance differences between using unix socket-based listeners over TCP ports? (Not just ...
Jason's user avatar
  • 1,724
55 votes
5 answers
42k views

Are FIFO, pipe & Unix domain socket the same thing in Linux kernel?

I heard that FIFOs are named pipes. And they have exactly the same semantics. On the other hand, I think Unix domain socket is quite similar to pipe (although I've never made use of it). So I wonder ...
Justin's user avatar
  • 713
47 votes
4 answers
139k views

Simple shell script to send socket message

For testing purposes I need to create a shell script that connects with a remote IP>Port and sends a simple text TCPIP Socket message.
Bachalo's user avatar
  • 1,101
42 votes
2 answers
48k views

/proc/PID/fd/X link number

In Linux, in /proc/PID/fd/X, the links for file descriptors that are pipes or sockets have a number, like: l-wx------ 1 user user 64 Mar 24 00:05 1 -> pipe:[6839] l-wx------ 1 user user 64 Mar 24 ...
Thanatos's user avatar
  • 917
37 votes
3 answers
34k views

Why are TCP/IP sockets considered "open files"?

I need some assistance grasping what I'm sure is a fundamental concept in Linux: the limit for open files. Specifically, I'm confused on why open sockets can count towards the total number of "open ...
Mike B's user avatar
  • 8,870
35 votes
2 answers
23k views

What does the @ symbol denote in the beginning of a unix domain socket path in Linux?

When I run netstat --protocol unix or lsof -U I see that some unix socket paths are prepended with @ symbol, for example, @/tmp/dbus-qj8V39Yrpa. Then when I run ls -l /tmp I don't see file named dbus-...
golem's user avatar
  • 2,278
35 votes
3 answers
72k views

How do I reserve ports for my application?

How do I reserve a list of ports for my custom applications? To be specific, the product I'm creating has a lot of processes and a lot of intercommunication between them. The problem I'm having is ...
Michael Baker's user avatar
35 votes
2 answers
37k views

Understanding output of lscpu

You can see the output from lscpu command - jack@042:~$ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 56 On-...
cph_sto's user avatar
  • 453
32 votes
2 answers
15k views

Why is socket path length limited to a hundred chars?

On Unix systems path names have usually virtually no length limitation (well, 4096 characters on Linux)... except for socket files paths which are limited to around 100 characters (107 characters on ...
WhiteWinterWolf's user avatar
31 votes
3 answers
35k views

Is there a file for each socket?

"Everything is a file" in the UNIX World. Above sentence is famous. When I run echo "hello programmer" >> /dev/tty1 , I can watch the given string on TeleType 1 , .... What and where is file ...
PersianGulf's user avatar
  • 10.8k
30 votes
4 answers
87k views

How does the server find out what client port to send to?

As I understand it this is what happens when a client makes a connection request: The server will be bound to a particular port number. The port number is always bound to a listening process. Since ...
Subi Suresh's user avatar
26 votes
4 answers
5k views

Are Unix Internet sockets files?

I understand that "Everything is a file" is one of the major concepts of Unix, but sockets use different APIs that are provided by the kernel (like socket, sendto, recv, etc.), not like normal file ...
user3718463's user avatar
25 votes
1 answer
5k views

= sign at the end of .sock files in the ls output

I'm running the zsh shell in emacs. When I run ls I get a = at the end of .sock files. What does the = mean? Is it unique to unix sockets?
c-o-d's user avatar
  • 696
24 votes
1 answer
45k views

How to get more info about socket file?

For a socket file likes this: # ls -alti socket 14112 srw------- 1 root root 0 Nov 15 20:03 socket # cat socket cat: socket: No such device or address Since cat command is useless here, is there ...
Nan Xiao's user avatar
  • 1,407
22 votes
2 answers
73k views

How to make a TCP socket time out

For network catastrophe simulations of our server environment, we are looking for a way to intentionally timeout a TCP socket. Are there any simple ways for existing sockets? Also, little C test-case ...
er453r's user avatar
  • 867
18 votes
1 answer
57k views

How do I list all sockets which are open to remote machines?

A vanilla ss -l lists (on my current machine) lots of open sockets, with various Netid types and many of which are only listening on localhost. How do I get a list of all and only those sockets ...
spraff's user avatar
  • 911
18 votes
1 answer
13k views

Idiomatic location for file based sockets on Debian systems

I am writing a daemon process for a Debian system in C that uses a Unix Domain Socket. If the daemon process's working directory is the root directory, is there an idiomatic directory to place the ...
recursion.ninja's user avatar
18 votes
3 answers
10k views

Kernel socket structure and TCP_DIAG

I'm working on a software which connects to a Real Time data server (using TCP) and I have some connections dropping. My guess is that the clients do not read the data coming from the server fast ...
Twister's user avatar
  • 283
17 votes
2 answers
35k 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, ...
geonaut's user avatar
  • 421
16 votes
3 answers
33k views

rpc.statd running on system not using NFS

I have a Debian machine that gets warnings (via the Tiger automatic auditor) that rcp.statd is listening on such-and-such socket. Googling shows rpc.statd is a daemon used by NFS. As far as I know, I'...
jrdioko's user avatar
  • 860
16 votes
2 answers
8k views

Does Linux automatically clean up abstract domain sockets?

There's a great answer on StackOverflow about providing a better lock for daemons (synthesized from Eduardo Fleury) that doesn't depend on the common PID file lock mechanism for daemons. There are ...
CivFan's user avatar
  • 457
15 votes
1 answer
32k views

ss is replacing netstat, how can I get it to list ports similarly to what I am used to?

I've been trying to modernise my way with Linux by, for one thing, ditching netstat for ss. I looked up my favourite command line flag for netstat in the ss man pages, and was very glad to find that ...
azzid's user avatar
  • 968
15 votes
1 answer
2k views

"ss" command in iproute package; why query slab table for timewait sockets?

Forgive me if this isn't the best forum for this question, but it seems more relevant to the kernel than to the programming itself. I'm writing a script that queries the system for open ports so that ...
Peter Grace's user avatar
14 votes
5 answers
23k views

Under AIX, how can I get the full path of a program bound to a port?

Under Linux I can use netstat -tulpnw and ps, like so: # netstat -tulpnw | grep :53 tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 1482/named udp ...
LanceBaynes's user avatar
14 votes
1 answer
2k views

Sharing unix sockets across unprivileged lxcontainers

I have two unprivileged containers and I'd like to share a unix socket between them. Each container has its own user on the host, complete with separate subuid and subguid mappings. I've tried ...
Cyclonit's user avatar
  • 161
13 votes
3 answers
23k views

How to check whether a socket is listening or not?

I want to observe a socket status periodically, so I need to check the socket status by command. Currently I list all listening sockets by ss and filter them by grep. ss -l | grep -q /run/php/php7....
ironsand's user avatar
  • 5,195
13 votes
2 answers
31k views

File descriptor linked to socket or pipe in proc [duplicate]

Possible Duplicate: /proc/PID/fd/X link number i have a question regarding the file descriptors and their linkage in the proc file system. I've observed that if i list the file descriptors of a ...
primero's user avatar
  • 590
13 votes
1 answer
1k views

Can someone explain the different types of unix domain sockets?

If I run netstat --all | grep ^unix some of the socket paths that are outputted are preceded with a '@' and some aren't. I've noticed that those preceded with a '@' don't show up when browsing the ...
Shum's user avatar
  • 1,355
12 votes
1 answer
14k views

How long is a TCP local socket address that has been bound unavailable after closing?

On Linux (my live servers are on RHEL 5.5 - the LXR links below are to the kernel version in that), man 7 ip says: A TCP local socket address that has been bound is unavailable for some time after ...
Tom Anderson's user avatar
12 votes
1 answer
4k views

How does moving a unix domain socket enable socat to monitor traffic?

socat can be used to monitor traffic across a Unix domain socket: sudo mv /path/to/sock /path/to/sock.original sudo socat -t100 -x -v UNIX-LISTEN:/path/to/sock,mode=777,reuseaddr,fork UNIX-CONNECT:/...
Matt R's user avatar
  • 385
12 votes
2 answers
2k views

What is the difference between &6 and /dev/fd/6?

To read from file descriptor 6 I can use <&6 or </dev/fd/6 (aka /proc/self/fd/6). Usually both work equally well. However if that file descriptor happens to be a socket, strange things ...
michas's user avatar
  • 21.5k
12 votes
1 answer
85k views

max no of tcp connections on a linux system

I know that /etc/security/limits.conf provides the persistent soft and hard limits for several values. However, in the relevant list there is no indication about imposed limits on: a) concurrent ...
pkaramol's user avatar
  • 2,779
11 votes
2 answers
14k views

Local unix socket - rough idea of throughput

Is anyone aware of throughput benchmarks / measurements for using a local unix socket for inter-process communication? I want to illustrate the performance benefit of having a local database ...
sa289's user avatar
  • 774
11 votes
3 answers
2k views

What characterizes a file in Linux/Unix?

What characterizes a file in Linux/Unix? A file can have many types: regular file, directory, symlink, device file, socket, pipe, fifo, and more that I miss. For example, a symlink: $ sudo file /...
Tim's user avatar
  • 101k
11 votes
1 answer
4k views

What is a generic socket and how does it relate to a network device?

I'm trying to understand how network drivers work under Linux. This Q&A showed that the network device in Linux isn't represented by a device file. It states that network drivers work with sockets....
TheMeaningfulEngineer's user avatar
11 votes
0 answers
853 views

What is the purpose of sockets in layman terms? [duplicate]

I met several times the term "socket", so I looked it up on different sites, but each of them required too much knowledge in order to understand the explanation. What I read were things like: ...
Abdul Al Hazred's user avatar
10 votes
2 answers
25k views

How to 'strace' a unix domain socket?

Kind of hard to explain but I noticed when straceing the PID that has the socket open I cannot see any of the communication. How can I sit in the middle of a socket file to watch communication?
user avatar
10 votes
2 answers
11k views

Write inside a socket open by another process in Linux

Is it possible on Linux for a process to write inside a socket open by another one? Let's say I open a connection to google.com using netcat: myuser@linux:~$ nc google.com 80 Now I can lookup for ...
otaku22's user avatar
  • 101
10 votes
1 answer
885 views

X.org working with no socket in chroot?

I have a chroot setup and I've been running graphical applications from it with no problem. The only setup I've done is set DISPLAY=:0 and it works. However I always thought Unix domain sockets were ...
Scoopta's user avatar
  • 1,510
9 votes
5 answers
48k views

How can I tell if a TCP port is open or not? [closed]

I am trying to implement socket programming in C. When I try to connect from a client to a server (Ubuntu), it shows an error like "connection failed". So I think the problem is with the port. I am ...
dxr's user avatar
  • 101
9 votes
1 answer
1k views

Why doesn't file redirection to and from a named pipe work, but piping to cat does?

This is a simple echo server in Unix, using nc: mkfifo fifo cat fifo | nc -k -l 4458 -v | cat >fifo (based on this) As I can see it, the data flow works as follows: fifo (my named pipe) | | (...
Razvan's user avatar
  • 215
9 votes
8 answers
47k 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 ...
Alper Turan's user avatar
9 votes
1 answer
1k views

What happens to requests to a service that is stopped with SIGSTOP

If you send a SIGSTOP to a web server, does the kernel just tell the network stack to block/sleep all connections to that server's socket(s) until it is continued? It seems that the server timeout ...
Gregg Leventhal's user avatar
9 votes
1 answer
3k views

OEL6 Slow boot && Millions of socket files in /tmp/orbit-gdm

Background on question Lately I've been having some trouble with slow booting on the servers, sometimes over 2 hours to boot stuck on "Enabling Local Filesystem Quotas:" After searching I managed to ...
ChrisK's user avatar
  • 63
8 votes
1 answer
4k views

SELinux and docker: allow access to X unix socket in /tmp/.X11-unix

How to allow access to a particular X unix socket for a particular docker container with SELinux enabled? I prefer a solution with a setup of docker run --security-opt. On fedora 25, I found the ...
mviereck's user avatar
  • 2,457
8 votes
3 answers
9k views

Is there a way to identify the PID (or cgroup) of a socket without iterating through all the processes in /proc/

I need to identify the cgroup of a process given the socket. Specifically, I have a process on the same machine that is calling my process using tcp, and I need to identify the process or its cgroup. ...
jamie's user avatar
  • 231

1
2 3 4 5
9