woohoo! i finally understand sockets
posted 13 years ago
i had to write a research paper for my data communications class, so i chose sockets since i was kind of vague about them. here is the conclusion:
Sockets are used when programs require lower-level network communication. Examples include web browser/web server, ftp client/ftp server, e-mail client/e-mail server, file sharing programs (where each installation contains both a client and a server), and multi-player game programs (over the Internet or using LANs).
Applications that use URLs depend on another application that uses sockets. For example, suppose you create an e-commerce site. The user's browser sends an HTTP request (to the server's URL). Your server-side program sends an HTTP response (to the client's URL). The web server you are using to host your site, and the client's browser, create the sockets and takes care of the lower-level details for you.
Creating applications that use sockets is more complicated than creating applications that use URLs because sockets operate at a lower level in the OSI stack. You have to establish protocols, and also decide which ports to use. It is much easier to send a response to an HTTP request than it is to write both a client and a server program, establish a protocol, create the sockets, and coordinate communication between those sockets.