Learn something new every day
More Info... by email
Socket programming is a programming schema in which sockets are used and manipulated to create a connection between software. Sockets are used to connect software either between different computers or within the same computer so the programs can share data. Socket programming is used with instant messaging, Internet browsers, file sharing programs, and anything that forces the computer to connect to a system. Most sockets are programmed automatically, but some operating systems (OS) place this responsibility in the hands of the user.
Socket programming involves using a list of commands to connect a socket from one computer to another. For example, for an instant messenger program to work, it must connect to a second computer. To make this connection, a socket is employed. By forging the connection, the two computers are now able to link together and speak to one another.
Peer-to-peer (P2P) programs are special cases when it comes to socket programming. Most programs act either as a client or a server. A P2P program acts as both, which is why users are able to download files from one person while files are downloaded from the user at the same time.
While most socket programming is used so two computers can interact, it also is useful for two programs in the same computer. Known as interprocessing, this allows one program to take information from another program and use it. For example, if one program is a slideshow creator and needs information from a video program to play videos in the slide, then a socket is made to connect the slideshow and video programs. Interprocessing is common, but not as common as using sockets between two computers.
When using socket programming, the programmer and user must remember that sockets are bidirectional. This means both computers can speak to one another while also taking data from each other. Opening up a computer to another system can be dangerous, because the other side will be able to launch an attack if its user is malicious. This is rare, though, and connecting a socket to another system is usually safe.
Sockets usually are made automatically on the OS, or with limited programming. In OS interfaces where the command line is used often, the user will frequently have to forge the sockets manually. This forces the user to know some basic socket programming so these important connections can be made. If the socket is not created, then the computer will not be able to communicate with other systems, limiting the computer’s usefulness.
One of our editors will review your suggestion and make changes if warranted. Note that depending on the number of suggestions we receive, this can take anywhere from a few hours to a few days. Thank you for helping to improve wiseGEEK!