what is the difference between socket and sock?
I found that there is "socket: /tmp/mysql.sock" in some config files, so what is the difference betw开发者_Go百科een socket and sock ?
sock
is an abbreviation of socket
(also a sock is something that is worn on the feet).
'Socket' is the technical term for a handle that refers to a network endpoint. It originated in the Unix API for networks, and has since leaked over to Windows.
A socket can refer to TCP connection, a UDP packet endpoint, an X.25 connection, or ... a Unix domain socket, which is a mutant named pipe.
People tend to name Unix domain sockets with 'sock' in the name, but there's no requirement.
Sock is just an abbreviation for socket. But if you see a socket as a file it's a Unix socket as opposed to a TCP socket.
This link has some information on the differences between the two.
http://lists.freebsd.org/pipermail/freebsd-performance/2005-February/001143.html
Basically a TCP socket communicates over the network, and a Unix socket is similar except it can only connect to your localhost. (127.0.0.1
)
精彩评论