What do files with sock extension serve?

3

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

I always see this on Linux operating systems.

Example:

 /var/run/mysql/mysql.sock

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

I wanted to know what the purpose of this file sock is.

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

    
asked by anonymous 05.06.2017 / 14:25

1 answer

1
  

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

Sockets are communication points on the same or different computers to exchange data. They are supported by Unix, Linux, BSDs, Windows, other Macs. It is faster and more efficient communication than TCP / IP.

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

    
08.06.2017 / 04:56