Talk:Network socket

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computing / Networking (Rated Start-class, Low-importance)
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 Low  This article has been rated as Low-importance on the project's importance scale.
Taskforce icon
This article is supported by Networking task force (marked as Mid-importance).

Suggested merge[edit]

I suggest that Ip socket be merged into this article. It appears to be a stub covering the same subject. I plan to complete this merge by 2006-09-08 if there is no objection and/or a consensus is reached. -- Ratarsed 11:46, 29 August 2006 (UTC)

Done -- Ratarsed 18:46, 12 September 2006 (UTC)

If this article is about IP sockets then the comment about SNA should be moved elsewhere. SNA only runs over DLSw on the Internet as it as its own lower level protocol. In addition there is not a clear definition here of a socket. Does it include the API? The queue? If there are multiple definitions they should be clearly identified and listed. The higher level definition of "socket" is in error by including "an end-point of a bi-directional communication link in the Berkeley sockets API". Pointing to a parent entity is not a valid definition. User:jbottoms76


Could someone go over the process an application might take in creating a socket -I'm interested in how port numbers are assigned in particular User:DragonSlayre12:14pm, 9 September 2007 (New Zealand time). —Preceding unsigned comment added by (talk) 00:16, 9 September 2007 (UTC)

Missing references: The article does not refer to any API standard. There are some de facto standards for Berkely Sockets and WinSock.

Citations to RCF/STD are needed. For Example, RFC3493, R. Gilligan et al., “Basic Socket Interface Extensions for IPv6,” February 2003, discusses difference between v.4 and v.6 versions of the library. —Preceding unsigned comment added by (talk) 04:22, 7 February 2010 (UTC)

Article Quality[edit]

This seems more like a Java tutorial on socket programming as opposed to an article in an encyclopaedia. -- 01:17, 9 November 2007 (UTC)

Where did that Java code come from?--Adoniscik 04:45, 13 November 2007 (UTC)

Obviously, this article was extracted from a book or tutorial: "It also draws on other skills, such as multi-threaded programming, discussed in the next chapter. For now, we'll focus on a simple, bare-bones TCP server that executes as a single-threaded application" o.O "next chapter"??? :O -- 16:32, 14 November 2007 (UTC)

Should we rephrase this?[edit]

Hi, in the phrase "The server creates one socket for each client, and these sockets share the same local socket address."

Would it be more appropriate to write "The server creates one socket for each client, and these sockets share the same local IP address."?

Because if I understood correctly, the socket address is composed by IP:PORT, the server will create a new socket for each client, say,,, etc. This way the sockets created on the server would share the same IP address, but their socket addresses would be different.

Anyone agrees? — Preceding unsigned comment added by Bnegrao2 (talkcontribs) 20:37, 19 January 2013 (UTC)

Suggestion for rephrasing in the Overview section[edit]

I find the description at the beginning of the Overview section a bit confusing: "An Internet socket is characterized by a unique combination of the following :

  • Local socket address: ...
  • Remote socket address: ...
  • Protocol..."

The reason I find it confusing is that it does not distinct well enough between the natural characteristics of any socket, being an end point, meaning having local socket address and protocol, and the special case when a socket is connected to a remote end-point, in which case it has the knowledge of the remote socket address.

Therefore, I would like to suggest the following rephrasing of the first 2 sub-sections of the overview section:

"An Internet socket is characterized by the following:

  • Local socket address: Local IP address and port number,
  • Protocol: A transport protocol (e.g., TCP, UDP, raw IP, or others). TCP port 53 and UDP port 53 are consequently different, distinct sockets.

A TCP socket that has been connected to another socket, e.g. during the establishment of a TCP connection, will also be characterized by a remote socket address. As discussed in the client-server section below, this is necessary since a TCP server may serve several clients concurrently. The server creates one socket for each client, and these sockets share the same local socket address from the point of view of the TCP server."

Any thoughts? Ronny Weisman (talk) 07:43, 21 January 2015 (UTC)

I think the underlying problem is the vagueness of the term "socket". However, whatever theoretical meaning the term may have with regard to being an endpoint, the overview is correct in that a socket is identified by (protocol + local IP:port + remote IP:port). Indeed, the netstat command mentioned shows exactly that information. Before a connection is established, a host may listen on (protocol + local IP:port), and people call that a socket—but is it? If emphasis is to be given, it should be to show a working socket (five numbers). We could resort to finding what reliable sources say, but terms like this are often used ambiguously. Johnuniq (talk) 08:51, 21 January 2015 (UTC)
A socket can be a UDP socket, or a raw IP socket, therefore not connected to another end-point. In this case it will only have a local address and a protocol, but is is still a socket. Also analogy to electronic socket, being an end-point, either connected to another point or not, makes the network socket concept very clear. In my mind, it shall be emphasized that having a remote address is a special case of a socket usage. Ronny Weisman (talk) 16:50, 22 January 2015 (UTC)
The problem is that after your edit the protocol point started by mentioning TCP which gives a strong suggestion it is talking about TCP sockets. The current text (from before your edit) notes "Only for established TCP sockets." for the Remote socket address. If some improvement were warranted, I think it would involve splitting the text into two parts to avoid clumsy expressions—some sockets have five numbers, and some have three. By the way, you might like to review WP:TP about indenting replies—I put two colons in front of your last comment, and three in front of this comment. Johnuniq (talk) 00:54, 23 January 2015 (UTC)
I agree, the 2nd sub-section that I suggest to rephrase shall better start with: "A socket that has been connected to another socket, e.g. during the establishment of a TCP connection..." removing the TCP from the start of the sentence. What do you say? Ronny Weisman (talk) 13:57, 26 January 2015 (UTC)
Give it a go, but that doesn't sound quite right to me. An established TCP socket is a single thing—the host at each end records information about the socket using five numbers, and it's not thought of as a socket at X connected to a socket at Y. What I was suggesting is that the text would need to be split into two separate parts, one discussing a stateless socket, and one discussing a TCP-style socket. With luck someone will offer another opinion. Johnuniq (talk) 23:40, 26 January 2015 (UTC)

────────────────────────────────────────────────────────────────────────────────────────────────────When I first learned about sockets c. 1989, I had only the exasperating documentation which babbled about socket attributes, protocols, and other stuff which did nothing to describe what it is. With much hindsight and experience, it should have said something like this:

A socket is a generalized interface for establishing connections. Connections may be made to the same machine or another machine. The procedure to establish a connection varies depending on the type of socket. Server sockets are available for others to initiate a connection to. Client sockets are associated with a remote socket after they are created. Connectionless sockets manage packet level communication. Connected sockets manage a communication channel which is almost completely oblivious to the underlying mechanisms. All four combinations occur: Server connectionless, server connected, client connectionless, and client connected. Etc.

EncMstr (talk) 00:14, 27 January 2015 (UTC)

This is a good explanation, and it coincides well with what I'm suggesting: conectionless socket is characterized by local network address and protocol, and connected socket has in addition a remote network address characteristic. In addition, I think we should take into mind the life-cycle of a connected socket: a socket is usually created un-connected, having local network address and protocol, and later on it may be connected, getting the remote network address characteristic. Do you have a vote regarding my modification suggested here? Ronny Weisman (talk) 14:41, 28 January 2015 (UTC)

Merge proposal for Datagram socket into Network socket[edit]

The discussion for the proposed merger of Datagram socket into this article (Network socket) is at: Talk:Datagram socket#Missing scope distinction; Merge destination re-proposed. Sparkie82 (tc) 17:46, 1 January 2016 (UTC)

I Support this proposal. I have put up merge banners on the two articles. ~Kvng (talk) 21:37, 24 August 2017 (UTC)

Socket without address??[edit]

The explanation says : "Sockets need not have an address (for example for only sending data)" Can someone explain how that works?

Surely, to build a connection, you have to have a source socket (address and port) and a destination socket (address and port). If you have no source address, how do your packets reach the network (which interface should they be sent through)?

Should it say "Sockets need not have an address explicitly set (for example for only sending data will use the IP address of the interface used for sending and be automatically assigned a high port number)" With perhaps a link to "high port numbers" -> Or am I missing something? — Preceding unsigned comment added by Max.allan.surevine (talkcontribs) 07:26, 3 August 2016 (UTC)