Librenix  
(Show all Socket articles . . .
)  
Headlines | Linux | Apps | Coding | BSD | Admin | News
Information for Linux System Administration 

A simple introduction to sockets

Up
vote
Down

A little network programming with example code.
A socket is a connection from a process to another process. The two processes are typically on different machines, but they can also be on the same machine.

The most common use of a socket is to connect a client with a server, similar to placing a phone call to some phone service. The client creates a socket (picks up the phone), then connects it to the server (dials the phone, waits for an answer).

Once the sockets are connected, communication is generally bi-directional, using some agreed-upon protocol. You must have a protocol to know who is talking at any given time, and what it means. For example, the HyperText Transfer Protocol (HTTP) defines how to get a Web page, including defining precisely each side's role in the conversation. Simple Mail Transfer Protocol (SMTP) defines the transmission of email, and so on. When the connection is finished, both sides hang up.

To Perl, a socket is presented as a filehandle...
Update April 4, 2005: Librenix is now featuring a Linux multithreaded Socket programming game server project in C. The Space Tyrant design is covered here and the first Space Tyrant code release is discussed here.
 read more | mail this link | score:7804 | -Ray, July 14, 2003 (Updated: April 4, 2005)
More Programming articles...

Abstract Art Prints by Ray Yeargin

coding headlines

Develop your own Raspberry Pi OS

Unix: Shell Script Wrapper Examples

Introduction to Perl one-liners

E-book: Perl One-Liners Explained

e-book: Sed One-Liners Explained

String matching in regular expressions

Apache2, mod_rewrite tutorial: Redirect requests by device

 

Firefox sidebar

Site map

Site info

News feed

Features

Login
(to post)

Search

 
Articles are owned by their authors.   © 2000-2012 Ray Yeargin