1

Is there a difference between a "socket" or a "transport", or are they interchangeable. I only ask because I see a lot of libraries that seem to do the same thing, but differ slightly only in how the name functions/methods/properties/classes.

My understanding is a "socket" is a stream connecting servers/network devices together and a "transport" is the scheme the connection uses (E.g. TCP is a transport).

Am_I_Helpful
  • 18,735
  • 7
  • 49
  • 73
Nathan Bishop
  • 623
  • 1
  • 5
  • 11
  • Is your question related to the exact difference between those 2 words? Or **SSL** vs **TSL** . Transport and socket are interchangeably used and I can understand the confusion sometimes. – izk Apr 12 '16 at 14:28
  • It's between those two words. I know the difference between SSL and TLS. – Nathan Bishop Apr 12 '16 at 14:35

2 Answers2

1

Is there a difference between a "socket" or a "transport", or are they interchangeable?

Till now, I haven't come across the word transport as a single word. I've always read transport layer everywhere across the transport. I'd ask you for the external references which you're quoting(and getting confused). Even in the Java's networking library, I never heard/read about transport as an independent existential entity(within my limited experience)!

I only ask because I see a lot of libraries that seem to do the same thing, but differ slightly only in how the name functions/methods/properties/classes.

I think you're getting confused because of TLS/SSL. Here TLS is the successor of SSL. You shouldn't correlate socket and transport with this. BTW, TLS/SSL are application layer protocols.

My understanding is a "socket" is a stream connecting servers/network devices together and a "transport" is the scheme the connection uses (E.g. TCP is a transport).

Your both statements are incorrect (at least first for sure)! Socket is not a stream; TCP isn't a transport, but a transport protocol of TCP/IP.

In simple words, a network socket is an endpoint of a connection across a computer network. Sockets are internally often simply integers, which identify which connection to use. Sockets need not have an address (for example for only sending data), but if a program binds a socket to an address, the socket can be used to receive data sent to that address.

Whereas, the transport layer is a conceptual division of methods in the layered architecture of protocols in the network stack in the Internet Protocol Suite and the Open Systems Interconnection (OSI). The best-known transport protocol of TCP/IP is the Transmission Control Protocol (TCP)

Am_I_Helpful
  • 18,735
  • 7
  • 49
  • 73
1

I think you came up with this question because PHP uses these concepts in a confusing way. For example transport definition and the concept of stream sockets. I'm not a PHP programmer but from what I noticed, its names are not very intuitive.

In Operating Systems, socket is an operating system API for applications to communicate through certain protocol.

In Networking and Operating Systems, there are two layered communication models: OSI and TCP/IP. In both of them, there is a Transport Layer that runs above the network layer. The main functionality of this transport layer is to multiplex the services provided by the network layer among different TSAP's (Transport Services Access Points) used by different applications (running in the application layer in the TCP/IP model). Some examples of transport layer protocols are: TCP, UDP, SCTP. The concept of TSAP is what we know as TCP/UDP/SCTP ports.

There are different types of sockets: Stream and datagram sockets (TCP and UDP respectively), raw socekts, unix domain sockets, packet sockets (in Linux), etc.

Now, an AF_INET socket can be a stream socket for TCP (because it is stream oriented) or a datagram socket for UDP One explanation here.

Specifically, in TCP and UDP, a socket is defined by a tuple (source IP, source port, destination IP, destination port).

SSL and TLS run above TCP (there is something also for UDP but ...) and it's possible to say these are application layer protocols but here the separation line is not so clear. Some higher level languages, Java and others, have secure sockets using SSL or TLS.

From what I read in the mentioned links, PHP has the concept of stream sockets, which is different than the general operating system concept of sockets. They abstract you from the bare operating system socket. The stream socket lets you select different transports (tcp, udp, ssl, unix, etc.). I assume it refers to different mechanisms (not only protocols but also mechanisms like unix sockets) of transporting data and if you read in stream sockets you will see that behind the scenes it opens a real stream socket for TCP so called "transport" and a datagram socket for UDP so called "transport".

Now calling it stream socket for udp transport is confusing. I don't know if PHP makes you see a UDP socket as a stream oriented socket, in that case it would make sense (I leave this part of the response to some PHP expert).

Finally, I hope after this explanation you will conclude that socket and transport are not interchangeable concepts, both in the general concepts of operating systems and in PHP.

Community
  • 1
  • 1
rodolk
  • 5,606
  • 3
  • 28
  • 34
  • Yes, you are right in that I came across these concepts from PHP (I develop mainly in PHP). I've been trying to learn C and low-level language concepts hence the confusion. I have since become much more experienced in these concepts now. – Nathan Bishop Apr 26 '19 at 03:17