Tuesday 19 July 2016

Sockets: Big shoes to fill

I don't know what sockets are. All I know (and need to care so far) is that they are needed if you want be start learning how code networking stuff.

A computer network is machines present remotely with respect to one another and communicating somehow. This communication is done through exchanges of packets. These packets contain data along with other necessary information (header, footer and some more headers). A socket is what we use to encapsulate these packets in our computer programs. I have been lead to believe that everything is a file in Linux (even Unix). And that network connection to another machine is also done through a dynamically created file (stored temporarily somewhere in our computer). A socket is nothing but a unique id for that file. Once we have this id, we can do whatever we want to do with that file (whatever needs to be defined, it's not literally whatever). Hence we can communicate. To reiterate my point, sockets are essential if we want to communicate with other machine using some programming language (in my case C). Hey! maybe I do at least know what a socket is. Yay me.

Obviously the whole network programming thing is too vast to be contained only by the concrete knowledge of sockets. And moreover even a concrete knowledge of sockets is not a small feet by any means. I have just started out on this. My reference is the material at the following link: The beej's Guide

Check out their book as well. It's short (51 pages) and unsigned (no negatives to it).

No comments:

Post a Comment