Search /
Docfinder:
Advanced search  |  Help  |  Site map
RESEARCH CENTERS
SITE RESOURCES
Click for Layer 8! No, really, click NOW!
Networking for Small Business
TODAY'S NEWS
iPhone 5 rumors for the week ending May 18
Cisco's wireless unit shifts emphasis to "mobility"
Comcast ditches flat 250GB bandwidth cap for tiered service approach
Open-source messaging at (nearly) the speed of light
Social media a boon for businesses, but creates security quagmire
Academics propose groundbreaking uses for Watson
With Verizon pushing more into data caps, Sprint touts unlimited option
J*******k: Dirty word disappears from Apple iTunes store
Survey: BYOD sparks enterprise investment in Unified Communication and Collaboration
Privacy advocates fear CISPA
Doctors warned not to use social media with patients
Cisco mobility bundles target BYOD, mobile virtual desktop
iPhone 5 said, again, to have 4-inch display
Ethernet switching gets specialized
'Thelma & Louise,' 'Beetlejuice' star Geena Davis wins major telecom award
/

Toward a better understanding of sockets

Today's breaking news
Send to a friendFeedback


The term "sockets" crops up all the time in the TCP/IP world, but do you really know what it means? Basically, it is the method of identifying a specific process running on a machine that is accessible via an IP connection. More importantly, it is also the common name for the standard API for TCP/IP.

The Sockets API - also called the Berkeley Sockets Interface - was developed at the University of California at Berkeley for the 4.1c release of BSD Unix in the early 1980s (by the by, BSD stands for Berkeley Software Distribution). The simplicity of the interface made it common in Unix variants, including SCO, Linux and SunOS. Ultimately, it was supported by Windows (95, 98, NT and CE), NetWare, BeOS and a slew of other operating systems.

Berkeley Sockets provides applications with two ways to access network transport services: connection-oriented (a.k.a. session- or streamoriented), whereby TCP is used to maintain a channel between the client and server; and connectionless (a.k.a. datagram) communications, which use the User Datagram Protocol (UDP) to transfer data packets from one machine to another without guaranteed delivery.

The concept of sockets is straightforward: To send a message to a machine is not enough - you need to be able to send the message to a specific software process, an end point for the communication. By giving each service process running on a machine a "port" - a numeric value used to identify the process - a client application can distinguish between, say, a file transfer service and a Web service.

The Internet Assigned Numbers Authority (www.iana.org) sets the port value for a given service. For example, Web servers, by default, use TCP connections on Port 80. FTP servers are a little more complex, using TCP on Port 21 for commands and Port 20 for data transfers.

Protocols such as echo (Port 7) use UDP or TCP, while SNMP (which uses Port 161) only uses UDP. Most services can be allocated to different port numbers if required. For example, a Web site might run a second Web server on Port 8080.

It is the combination of a port and an IP address that makes a socket. Each client application has a unique socket associated with it, while the socket for a service process may support multiple instances of a service.

For example, a Web server might receive a number of service requests on Port 80 in a short period. Instead of handling the requests on a first-in, first-out basis, the server could launch a copy of itself for each request. Knowing the client's socket allows the results of each request to be returned to the correct client.

This strategy ensures that service requests that take a long time to complete (for example, having a Web server-based application perform a database lookup) don't block other requests that can be satisfied quicker (such as simple Web content retrievals).

The socket API, while simple, is not particularly elegant, and programmers usually access TCP/IP communications through higher-level APIs, such as Remote Procedure Calls.

Under Windows, of course, things are different, and there's a variant of the Berkeley Sockets Interface specifically for Windows called, not too surprisingly, the Windows Socket Specification (WinSock).

Currently, most of the Windows market uses the WinSock 1.1 implementation, but Microsoft is slowly but surely moving the market toward WinSock 2, described by some as WinSock 1.1 on steroids.

The bottom line is that due to the rise of the Internet and TCP/IP, sockets are now the dominant communications mechanism and look likely to remain in that position for a long time to come.

Send a message to the Gearhead socket at gh@gibbs.com.

RELATED LINKS


NWFusion offers more than 40 FREE technology-specific email newsletters in key network technology areas such as NSM, VPNs, Convergence, Security and more.
Click here to sign up!
New Event - WANs: Optimizing Your Network Now.
Hear from the experts about the innovations that are already starting to shake up the WAN world. Free Network World Technology Tour and Expo in Dallas, San Francisco, Washington DC, and New York.
Attend FREE
Your FREE Network World subscription will also include breaking news and information on wireless, storage, infrastructure, carriers and SPs, enterprise applications, videoconferencing, plus product reviews, technology insiders, management surveys and technology updates - GET IT NOW.