TCP / IP is a family of network protocols. IP is a lower-level protocol that is responsible for receiving data packets from place to place over the Internet. TCP sits on top of IP and adds the semantics of the virtual circuit / connection. Only with IP can you send and receive only independent data packets that are not organized into a stream or connection. You can use almost any physical transport mechanism to move IP packets. For LANs, this is usually Ethernet, but you can use anything. There, even the RFC indicates a way to send IP packets using a carrier pigeon.
Sockets is a semi-standard API for accessing the network functions of the operating system. Your program can call various functions called a socket, bind, listen, connect, etc., send / receive data, connect to other computers and listen to connections from other computers. Theoretically, you can use any family of network protocols through the socket API - the protocol family is the parameter that you pass, but these days you almost always specify TCP / IP. (Another option that is used in conjunction with local Unix sockets.)
MPI is an API for transferring messages between processes running on a server cluster. MPI is higher than TCP / IP and sockets. It can theoretically use any family of network protocols, and if it uses TCP / IP or another family supported by the socket API, then it probably uses the socket API to communicate with the operating system.
source share