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:7864 | -Ray, July 14, 2003 (Updated: April 4, 2005)
More Programming articles...

Colorful Abstract Art

coding headlines

No Starch Press has published my Perl One-Liners book!

OpenShift Online: a non-developer guide

Detailed Error Handling In Bash

Tutorial: Create an NFS-like Storage Server with GlusterFS on Ubuntu 12.10

 

Firefox sidebar

Site map

Site info

News feed

Features

Login
(to post)

Search

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