A socket is a reliable connection for the transmission of data between two hosts.
Sockets isolate programmers from the details of packet encodings, lost and retransmitted packets, and packets that arrive out of order.
There are limits. Sockets are more likely to throw
IOException
s than files, for example.