Socket

A socket is a software component that helps computer programs communicate over a network. The term "socket" evokes a physical socket that you plug a networking cable into and through which all data travels. Applications establish software networking sockets for a similar purpose — all data an application sends out and receives over a network connection passes through its socket.

Sockets provide a standard method for a program to establish network connections. Software developers can use an API to create a socket managed by the operating system so that they don't need to write their own way from scratch. When the application needs to send data out over the network, it writes that data to the socket as if it were writing a file to a disk. The operating system detects this and automatically forwards the data packet out over the network and to its destination.

Each socket has a unique socket address that combines an IP address and a port number. This address identifies both the specific computer the socket is running on and the application that created it. Applications running on a server create sockets when they launch and maintain them in a listening state, while applications on clients can open and close sockets as needed. While a socket is open, the operating system monitors it for incoming and outgoing data packets and looks at each packet's socket address to know where to forward it.

For example, when you visit a website with your web browser, it creates a socket that connects to another one on a remote web server using its IP address and port number (80 for HTTP connections and 443 for HTTPS connections). The browser sends a request for a specific webpage to this socket, which the operating system detects and forwards to the web server. When the web server sends the requested page back to your computer, the operating system looks at the socket address and knows to send it back to the web browser.

Updated November 9, 2023 by Brian P.

quizTest Your Knowledge

Which of the following is an online advertising model based on user actions?

A
CPA
0%
B
MPA
0%
C
PPA
0%
D
RPA
0%
Correct! Incorrect!     View the CPA definition.
More Quizzes →

The Tech Terms Computer Dictionary

The definition of Socket on this page is an original definition written by the TechTerms.com team. If you would like to reference this page or cite this definition, please use the green citation links above.

The goal of TechTerms.com is to explain computer terminology in a way that is easy to understand. We strive for simplicity and accuracy with every definition we publish. If you have feedback about this definition or would like to suggest a new technical term, please contact us.

Sign up for the free TechTerms Newsletter

How often would you like to receive an email?

You can unsubscribe or change your frequency setting at any time using the links available in each email.

Questions? Please contact us.