Unix vs BSD vs TCP vs Internet sockets?
I am reading The Linux Programming Interface and it describes several different types of socket used on Linux:
- Unix domain
- Berkeley
- TCP
- Internet
One of the things the book said is that if you want to communicate between remote hosts, you couldn't use Unix domain sockets because they are for IPC on the same host. You have to use "Internet" sockets.
However, I am still a little confused how this relates with "TCP" sockets, Berkeley sockets and the other 2? What is their relationship? Why would you have an Internet socket as well as a TCP socket?
In short I am trying to understand all (have I missed any out?) the various different types of Unix sockets and under what circumstances I would use them?
linux sockets unix tcp posix
add a comment |
I am reading The Linux Programming Interface and it describes several different types of socket used on Linux:
- Unix domain
- Berkeley
- TCP
- Internet
One of the things the book said is that if you want to communicate between remote hosts, you couldn't use Unix domain sockets because they are for IPC on the same host. You have to use "Internet" sockets.
However, I am still a little confused how this relates with "TCP" sockets, Berkeley sockets and the other 2? What is their relationship? Why would you have an Internet socket as well as a TCP socket?
In short I am trying to understand all (have I missed any out?) the various different types of Unix sockets and under what circumstances I would use them?
linux sockets unix tcp posix
add a comment |
I am reading The Linux Programming Interface and it describes several different types of socket used on Linux:
- Unix domain
- Berkeley
- TCP
- Internet
One of the things the book said is that if you want to communicate between remote hosts, you couldn't use Unix domain sockets because they are for IPC on the same host. You have to use "Internet" sockets.
However, I am still a little confused how this relates with "TCP" sockets, Berkeley sockets and the other 2? What is their relationship? Why would you have an Internet socket as well as a TCP socket?
In short I am trying to understand all (have I missed any out?) the various different types of Unix sockets and under what circumstances I would use them?
linux sockets unix tcp posix
I am reading The Linux Programming Interface and it describes several different types of socket used on Linux:
- Unix domain
- Berkeley
- TCP
- Internet
One of the things the book said is that if you want to communicate between remote hosts, you couldn't use Unix domain sockets because they are for IPC on the same host. You have to use "Internet" sockets.
However, I am still a little confused how this relates with "TCP" sockets, Berkeley sockets and the other 2? What is their relationship? Why would you have an Internet socket as well as a TCP socket?
In short I am trying to understand all (have I missed any out?) the various different types of Unix sockets and under what circumstances I would use them?
linux sockets unix tcp posix
linux sockets unix tcp posix
edited May 2 '14 at 18:22
ValenceElectron
1,17651626
1,17651626
asked Apr 6 '14 at 18:16
user997112user997112
9,96827102219
9,96827102219
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
A socket is an abstraction. The tag definition used on SO for a socket is as good as any:
An endpoint of a bidirectional inter-process communication flow. This often refers to a process flow over a network connection, but by no means is limited to such.
So from that a major distinction are sockets that (1) use a network and (2) sockets that do not.
Unix domain sockets do not use the network. Their API makes it appear to be (mostly) the same to the developer as a network socket but all the communication is done through the kernel and the sockets are limited to talking to processes on the machine upon which they are running.
Berkeley sockets are what we know as network sockets on POSIX platforms today. In the past there were different lines of Unix development (e.g. Berkeley or BSD, System V or sysV, etc.) Berkeley sockets essentially won in the marketplace and are effectively synonymous with Unix sockets today.
Strictly speaking there isn't a TCP socket. There are network sockets that can communicate using the TCP protocol. It's just a linguist shorthand to refer to them as a TCP socket to distinguish them from a socket using another protocol e.g. UDP, a routing protocol or whatnot.
An "Internet" socket is a mostly a meaningless distinction. It's a socket using a network protocol. That eliminates Unix domain sockets, but most network protocols can be used to communicate on a LAN or the Internet, which is just collection of networks. (Though do note there are protocols specific to local networks as well as those that manage collections of networks.)
2
Thanks for this. So am I right in thinking there are only really two raw sockets- POSIX/Berkeley and Unix domain. You can take the POSIX/Berkeley and "bolt-on" various settings which effectively turns it in to an "internet" socket, or a TCP socket- but you need a Berkeley/POSIX socket for the underlying?
– user997112
Apr 6 '14 at 19:32
That sounds about right. You might want to use the term "base" rather than "raw" since raw sockets imply IP layer datagrams without any transport level protocol formatting e..g tcp, udp, etc.
– Duck
Apr 6 '14 at 21:44
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f22897972%2funix-vs-bsd-vs-tcp-vs-internet-sockets%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
A socket is an abstraction. The tag definition used on SO for a socket is as good as any:
An endpoint of a bidirectional inter-process communication flow. This often refers to a process flow over a network connection, but by no means is limited to such.
So from that a major distinction are sockets that (1) use a network and (2) sockets that do not.
Unix domain sockets do not use the network. Their API makes it appear to be (mostly) the same to the developer as a network socket but all the communication is done through the kernel and the sockets are limited to talking to processes on the machine upon which they are running.
Berkeley sockets are what we know as network sockets on POSIX platforms today. In the past there were different lines of Unix development (e.g. Berkeley or BSD, System V or sysV, etc.) Berkeley sockets essentially won in the marketplace and are effectively synonymous with Unix sockets today.
Strictly speaking there isn't a TCP socket. There are network sockets that can communicate using the TCP protocol. It's just a linguist shorthand to refer to them as a TCP socket to distinguish them from a socket using another protocol e.g. UDP, a routing protocol or whatnot.
An "Internet" socket is a mostly a meaningless distinction. It's a socket using a network protocol. That eliminates Unix domain sockets, but most network protocols can be used to communicate on a LAN or the Internet, which is just collection of networks. (Though do note there are protocols specific to local networks as well as those that manage collections of networks.)
2
Thanks for this. So am I right in thinking there are only really two raw sockets- POSIX/Berkeley and Unix domain. You can take the POSIX/Berkeley and "bolt-on" various settings which effectively turns it in to an "internet" socket, or a TCP socket- but you need a Berkeley/POSIX socket for the underlying?
– user997112
Apr 6 '14 at 19:32
That sounds about right. You might want to use the term "base" rather than "raw" since raw sockets imply IP layer datagrams without any transport level protocol formatting e..g tcp, udp, etc.
– Duck
Apr 6 '14 at 21:44
add a comment |
A socket is an abstraction. The tag definition used on SO for a socket is as good as any:
An endpoint of a bidirectional inter-process communication flow. This often refers to a process flow over a network connection, but by no means is limited to such.
So from that a major distinction are sockets that (1) use a network and (2) sockets that do not.
Unix domain sockets do not use the network. Their API makes it appear to be (mostly) the same to the developer as a network socket but all the communication is done through the kernel and the sockets are limited to talking to processes on the machine upon which they are running.
Berkeley sockets are what we know as network sockets on POSIX platforms today. In the past there were different lines of Unix development (e.g. Berkeley or BSD, System V or sysV, etc.) Berkeley sockets essentially won in the marketplace and are effectively synonymous with Unix sockets today.
Strictly speaking there isn't a TCP socket. There are network sockets that can communicate using the TCP protocol. It's just a linguist shorthand to refer to them as a TCP socket to distinguish them from a socket using another protocol e.g. UDP, a routing protocol or whatnot.
An "Internet" socket is a mostly a meaningless distinction. It's a socket using a network protocol. That eliminates Unix domain sockets, but most network protocols can be used to communicate on a LAN or the Internet, which is just collection of networks. (Though do note there are protocols specific to local networks as well as those that manage collections of networks.)
2
Thanks for this. So am I right in thinking there are only really two raw sockets- POSIX/Berkeley and Unix domain. You can take the POSIX/Berkeley and "bolt-on" various settings which effectively turns it in to an "internet" socket, or a TCP socket- but you need a Berkeley/POSIX socket for the underlying?
– user997112
Apr 6 '14 at 19:32
That sounds about right. You might want to use the term "base" rather than "raw" since raw sockets imply IP layer datagrams without any transport level protocol formatting e..g tcp, udp, etc.
– Duck
Apr 6 '14 at 21:44
add a comment |
A socket is an abstraction. The tag definition used on SO for a socket is as good as any:
An endpoint of a bidirectional inter-process communication flow. This often refers to a process flow over a network connection, but by no means is limited to such.
So from that a major distinction are sockets that (1) use a network and (2) sockets that do not.
Unix domain sockets do not use the network. Their API makes it appear to be (mostly) the same to the developer as a network socket but all the communication is done through the kernel and the sockets are limited to talking to processes on the machine upon which they are running.
Berkeley sockets are what we know as network sockets on POSIX platforms today. In the past there were different lines of Unix development (e.g. Berkeley or BSD, System V or sysV, etc.) Berkeley sockets essentially won in the marketplace and are effectively synonymous with Unix sockets today.
Strictly speaking there isn't a TCP socket. There are network sockets that can communicate using the TCP protocol. It's just a linguist shorthand to refer to them as a TCP socket to distinguish them from a socket using another protocol e.g. UDP, a routing protocol or whatnot.
An "Internet" socket is a mostly a meaningless distinction. It's a socket using a network protocol. That eliminates Unix domain sockets, but most network protocols can be used to communicate on a LAN or the Internet, which is just collection of networks. (Though do note there are protocols specific to local networks as well as those that manage collections of networks.)
A socket is an abstraction. The tag definition used on SO for a socket is as good as any:
An endpoint of a bidirectional inter-process communication flow. This often refers to a process flow over a network connection, but by no means is limited to such.
So from that a major distinction are sockets that (1) use a network and (2) sockets that do not.
Unix domain sockets do not use the network. Their API makes it appear to be (mostly) the same to the developer as a network socket but all the communication is done through the kernel and the sockets are limited to talking to processes on the machine upon which they are running.
Berkeley sockets are what we know as network sockets on POSIX platforms today. In the past there were different lines of Unix development (e.g. Berkeley or BSD, System V or sysV, etc.) Berkeley sockets essentially won in the marketplace and are effectively synonymous with Unix sockets today.
Strictly speaking there isn't a TCP socket. There are network sockets that can communicate using the TCP protocol. It's just a linguist shorthand to refer to them as a TCP socket to distinguish them from a socket using another protocol e.g. UDP, a routing protocol or whatnot.
An "Internet" socket is a mostly a meaningless distinction. It's a socket using a network protocol. That eliminates Unix domain sockets, but most network protocols can be used to communicate on a LAN or the Internet, which is just collection of networks. (Though do note there are protocols specific to local networks as well as those that manage collections of networks.)
edited Jul 23 '18 at 10:43
François Beaune
1,48942344
1,48942344
answered Apr 6 '14 at 18:48
DuckDuck
23k24977
23k24977
2
Thanks for this. So am I right in thinking there are only really two raw sockets- POSIX/Berkeley and Unix domain. You can take the POSIX/Berkeley and "bolt-on" various settings which effectively turns it in to an "internet" socket, or a TCP socket- but you need a Berkeley/POSIX socket for the underlying?
– user997112
Apr 6 '14 at 19:32
That sounds about right. You might want to use the term "base" rather than "raw" since raw sockets imply IP layer datagrams without any transport level protocol formatting e..g tcp, udp, etc.
– Duck
Apr 6 '14 at 21:44
add a comment |
2
Thanks for this. So am I right in thinking there are only really two raw sockets- POSIX/Berkeley and Unix domain. You can take the POSIX/Berkeley and "bolt-on" various settings which effectively turns it in to an "internet" socket, or a TCP socket- but you need a Berkeley/POSIX socket for the underlying?
– user997112
Apr 6 '14 at 19:32
That sounds about right. You might want to use the term "base" rather than "raw" since raw sockets imply IP layer datagrams without any transport level protocol formatting e..g tcp, udp, etc.
– Duck
Apr 6 '14 at 21:44
2
2
Thanks for this. So am I right in thinking there are only really two raw sockets- POSIX/Berkeley and Unix domain. You can take the POSIX/Berkeley and "bolt-on" various settings which effectively turns it in to an "internet" socket, or a TCP socket- but you need a Berkeley/POSIX socket for the underlying?
– user997112
Apr 6 '14 at 19:32
Thanks for this. So am I right in thinking there are only really two raw sockets- POSIX/Berkeley and Unix domain. You can take the POSIX/Berkeley and "bolt-on" various settings which effectively turns it in to an "internet" socket, or a TCP socket- but you need a Berkeley/POSIX socket for the underlying?
– user997112
Apr 6 '14 at 19:32
That sounds about right. You might want to use the term "base" rather than "raw" since raw sockets imply IP layer datagrams without any transport level protocol formatting e..g tcp, udp, etc.
– Duck
Apr 6 '14 at 21:44
That sounds about right. You might want to use the term "base" rather than "raw" since raw sockets imply IP layer datagrams without any transport level protocol formatting e..g tcp, udp, etc.
– Duck
Apr 6 '14 at 21:44
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f22897972%2funix-vs-bsd-vs-tcp-vs-internet-sockets%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown