Showing posts with label Networking. Show all posts
Showing posts with label Networking. Show all posts

Tuesday, June 2, 2009

Writing a Web Server in C

Though the above heading may give you a headache when thinking "how to do it?", in practical sense it is pretty simple. I'm not talking about a fully functioning Web Server with wide array of functionalities, but a simple Web Server that will cater basic requirements of a Web Server. Through web surfing I found out some interesting web links which helped me to write my simple Web Server.

The way in which I did it was,
  1. First, got hold of a chat server (I used a one which I have written already).
  2. Then implemented the logic for handling http.

Following links helped me a lot in understanding the domain knowledge. If you'd like to have a look at the code feel free to drop a comment, I will be more than happy to share it with you :) .

Monday, May 4, 2009

Setting up NS2 in Ubuntu

1. Download ns-allinone-2.33.tar from here.

2. Place it in somewhere and extract it.
$ cd /home/installations
$ tar -xvf ns-allinone-2.33.tar
3. Download & install some packages from repository.
$ sudo apt-get install build-essential autoconf automake libxmu-dev
4. Install the ns2.
$ cd ns-allinone-2.33
$ ./install
5. Edit paths.
$ gedit ~/.bashrc
Add follwoing lines on that file.
# LD_LIBRARY_PATH
OTCL_LIB=/home/installations/ns-allinone-2.33/otcl-1.13
NS2_LIB=/home/installations/ns-allinone-2.33/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:
$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY
TCL_LIB=/home/installations/ns-allinone-2.33/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/home/installations/ns-allinone-2.33/bin:/home/installations/ns-allinone-2.33/tcl8.4.18/unix:/home/installations/ns-allinone-2.33/tk8.4.18/unix
NS=/home/installations/ns-allinone-2.33/ns-2.33/
NAM=/home/installations/ns-allinone-2.33/nam-1.13/
export PATH=$PATH:$XGRAPH:$NS:$NAM
6. Validate it.
$ cd ns-2.33
$ ./validate
7. Create a symlink.
$ sudo ln -s /home/installations/ns-allinone-2.33/ns-2.33/ns /usr/bin/ns
8. Run it.
$ ns