Network socket is a core of the Internet communication. Socket is a link between request (client) and response (server) on lowest level provided you by the machine/OS.
Sockets are associated with specific combination of:
IP address and port (server and client addresses)
and Protocol (Standard, set of rules, describing how exactly machines should understand, encode/decode each other messages)
You open a socket over network when you want to establish a connection, then you receive some data from the server and, depending on protocol (like HTTP), you decode it or use a ready library.
socket() and similar functions in all programming languages are similar to fopen(), they return you a pointer you use in other functions to send/receive data through this already established connection.
Mev-Rael
Executive Product Leader & Mentor for High-End Influencers and Brands @ mevrael.com
Network socket is a core of the Internet communication. Socket is a link between request (client) and response (server) on lowest level provided you by the machine/OS.
Sockets are associated with specific combination of:
You open a socket over network when you want to establish a connection, then you receive some data from the server and, depending on protocol (like HTTP), you decode it or use a ready library.
socket() and similar functions in all programming languages are similar to fopen(), they return you a pointer you use in other functions to send/receive data through this already established connection.
Image from difference between socket programming and Http programming