Introduction &

Simple Examples

 

Ø Stevens's Texts (Stevens passed away Sept 1, 1999)

Ø Comers's Texts

Ø Introduction

Ø Discovering Network Topology

Ø Simple TCP Client/Server Examples

 

 


Ø   Steven's Texts:

Original textbook:

Unix Network Programming               (version 1)                           (1990)


Old Series:

·       Advanced Programming in the Unix Environment           (1992, 2nd 2005)

·       TCPv1: TCP/IP Illustrated, Vol. 1: Protocols                        (1993)

·       TCPv2: TCP/IP Illustrated, Vol. 2: Implementation              (1995)

·       TCPv3: TCP/IP Illustrated, Vol. 3: Misc.                               (1996)


New Series:

·       Unix Network Programming, Vol. 1:   APIs                       (1998, 3rd 2004)

·       Unix Network Programming, Vol. 2:  IPCs                             (1998)




Ø   Comers's Texts:

·       Internetworking with TCP/IP, Vol. 1: Protocols                  (1991, 5th   2006)

·       Internetworking with TCP/IP, Vol. 2: Implementation        (1992, 3rd   1999)

·       Internetworking with TCP/IP, Vol. 3: Applications             (1993, 2nd   1996)

 



Ø Introduction:

Network application: Client & Server   
 
 http://www.cs.odu.edu/~cs779/spring06/lectures/cltsrv.jpg

Client & Server on the same LAN:
http://www.cs.odu.edu/~cs779/spring06/lectures/lan.jpg
 


Client & Server on different LANs connected through a WAN:
http://www.cs.odu.edu/~cs779/spring06/lectures/wan.jpg
  
Layers in OSI model and Internet protocol suite:
http://www.cs.odu.edu/~cs779/spring06/lectures/layers.jpg 

 

 

 


Ø Discovering Network Topology: netstat & ifconfig
 

·      netstat  -ni :  provide information on the interfaces.

% hostname

Vega

 

% netstatni

Name  Mtu    Net/Dest      Address       

lo0     8232   127.0.0.0      127.0.0.1     

eri0   1500    128.82.4.0    128.82.4.19   

 

Name  Mtu  Net/Dest                                        Address                    

lo0     8252     ::1                                                 ::1                        

eri0    1500    fe80::203:baff:fe67:fbf7/10     fe80::203:baff:fe67:fbf7   

 

 

·      netstat  -nr : shows the routing table.

% netstat -nr

Routing Table: IPv4

Destination           Gateway           Flags  Ref     Use     Interface

default                 128.82.4.253         UG        1      28396    

128.82.4.0           128.82.4.19          U           1      52650     eri0      

224.0.0.0            128.82.4.19           U           1          0         eri0     

127.0.0.1            127.0.0.1               UH         3      44741     lo0      

Routing Table: IPv6

Destination/Mask            Gateway                   Flags Ref   Use    If  

fe80::/10                   fe80::203:baff:fe67:fbf7    U       1       0      eri0 

ff00::/8                      fe80::203:baff:fe67:fbf7    U       1       0      eri0 

::1                             ::1                                    UH      2   16696 lo0  

 

 

·       ifconfig   -a :  obtain details about all configured interfaces.

% ifconfig –a

 

lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1

        inet 127.0.0.1 netmask ff000000

eri0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2

        inet 128.82.4.19 netmask fffffe00 broadcast 128.82.5.255

 

lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1

        inet6 ::1/128

eri0: flags=2004841<UP,RUNNING,MULTICAST,DHCP,IPv6> mtu 1500 index 2

        inet6 fe80::203:baff:fe67:fbf7/10

 

 

 


Ø Simple TCP Client/Server Examples:

·       Wahab's Introduction to Network Programming at the Socket Level

·       Wrapper Functions

These functions calls: 
 
err_sys("message");
 

Which prints the “message” and then exits.

Thus do not use these functions if you plan to continue and not exit.

 

·       Daytime: Simple examples of client/server

The code of these examples is under:

/home/cs779/stevens3rd.book/unpv13e/intro

 

 

IPV4

ü   TCP daytime Server.

% daytimetcpsrv

 

ü   TCP daytime Client .

%  daytimetcpcli     127.0.0.1      // the ip of localhost

%  daytimetcpcli     128.82.4.108   // the ip address of the server host

 

 

IPV6

ü   TCP daytime  Server .

% daytimetcpsrvv6

 

ü   TCP daytime Client .

% daytimetcpcliv6   ::ffff:127.0.0.1

% daytimetcpcliv6   ::1                        //the ipv6 of localhost

% daytimetcpcliv6   ::ffff:128.82.4.108

% daytimetcpcliv6   fe80::203:baff:fe15:61d6   // ipv6 address of the server host