What are files with extension "Sock" for?

Asked

Viewed 377 times

3

Some applications, such as PHP-FPM and MYSQL, usually use in their settings a file with the extension .sock.

I always see this in Linux operating systems.

Example:

 /var/run/mysql/mysql.sock

As far as I understand it is related to socket connection.

I was wondering what the purpose of this file is sock.

My other curiosity is: Using it, it is not necessary to open a port for socket connections? The file with extension sock by itself would be the connection?

1 answer

1

For external connections yes, but this has to be done by the socket owner software.

Sockets are communication points on the same or different computers to exchange data. They are supported by Unix, Linux, Bsds, Windows, Mac others. Faster and more efficient communication than TCP/IP.

In addition to sending data, processes can send file descriptors on a Unix domain socket connection using system calls sendmsg() and recvmsg(). This allows the sending processes to grant access to the receiving process to a file descriptor to which the receiving process would otherwise not have access.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.