You are on page 1of 96

BITS Pilani

Pilani | Dubai | Goa | Hyderabad

Programming for the Networked Environments


Lecture-8, January 30, 2013 Rahul Banerjee, PhD (CSE)
Professor, Department of Computer Science & Information Systems

E-mail: rahul@pilani.bits-pilani.ac.in

Interaction Points
Simple basics that go into programming for the network-based applications: Generic and Socket APIs Briefly revisiting the TCP/IP Architecture Current State-of-the-art and Evolving Research Directions
From Clusters and Grids to Clouds Wearable Computing Ubiquitous or Pervasive Computing

Select References to the literature Summary


BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

How do we write simple programs for the networks?


Simplest way to understand this is to look at the way applications are expected to communicate over the network.
Lets assume that we need to write a simple application that could work for getting some data over the network! Example-1: A rudimentary short data transfer application and involved logic Example-2: An elementary large data transfer application and involved logic

Lets next see the way things get done in real systems!
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Simple Basics of Programming for Network-based Applications


The application-processes of the simplest kind might involve a client-server relationship. APIs help!
All network-capable Operating Systems have some application programming interface (API) that makes application-to-application communication possible over networks without necessarily knowing intricate details of the underlying mechanisms. University of California at Berkeleys BSD Socket API is one of the most common APIs in use for writing such applications Lets us see how things work in this case, from programmers point of view!
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Basic Operations Involved


Server-side operations Client-side operations In each case, in the world of the Internet, we have, often, two basic choices to make:
Octet-stream-oriented reliable communication <streams> Datagram-oriented so-called unreliable communication <datagrams> Create a socket or an end-point on the server side Associate a transport port or a local address at which the application shall listen to incoming requests Enable and announce that server is ready to listen at this port with queue-size Accept any incoming (passive) connection request <blocks>
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Lets see the first type first!

Basic Operations Involved


At client-side:
Create a socket or an end-point Send (passive) connection request to server

Overall:
Connect <blocks> Send Receive <blocks> . Close
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Lets take a closer look at the entire matter!

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Network Architecture of the Internet


ApplicaAon Layer

TCP (Transport) Layer

The Internet Layer The Host-to-Network Interface Link-Layer as per OSI Reference Model LLC Sub-layer MAC Sub-layer Physical layer

Physical-Layer as per OSI Reference Model


Wednesday, 30 January 13 (c) Dr. Rahul Banerjee, BITS-Pilani, INDIA

A Simplified Network Reference Model <for Instruction>


Application Layer
Upper Layer-to- Lower Layer Interface Same Layer -to- Same Layer Virtual Communication Interface Upper Layer-to- Lower Layer Interface Upper Layer-to- Lower Layer Interface Same Layer -to- Same Layer Virtual Communication Interface Same Layer -to- Same Layer Virtual Communication Interface Upper Layer-to- Lower Layer Interface Upper Layer-to- Lower Layer Interface Same Layer -to- Same Layer Virtual Communication Interface

Application Layer
Upper Layer-to- Lower Layer Interface

Host-1

Same Layer -to- Same Layer Physical Communication Interface

Host-2

(c) Dr. Rahul Banerjee, BITS-Pilani, INDIA

IPv4: The Header Structure


0
Ver. 4-bit IHL 4-bit Type of Service 8-bit Total Length 16-bit

31

Identification 16-bit

Flags 3-bit

Fragment Offset 13-bit

TTL 8-bit

Protocol Type 8-bit

Header Checksum 16-bit

Source Address 32-bit Destination Address 32-bit Options + Padding

Copyright: Dr. Rahul Banerjee BITS, Pilani (India)

10

IPv6: The Header Structure


0 4 16 31

Ver. TClass (4-bit) (8-bit) Payload Length (16-bit)

Flow Label (20-bit) Next Header Hop Limit (8-bit) (8-bit)

Source Address (128-bit) Destination Address (128-bit)


Copyright: Dr. Rahul Banerjee BITS, Pilani (India) 11

In the world of sockets: Telephony Analogy


Socket() Endpoint for communicaAon Bind() - Assign a unique telephone number. Listen() Wait for a caller. Connect() - Dial a number. Accept() Receive a call. Send(), Recv() Talk. Close() Hang up.

A TCP Server Client InteracAon

Data Structures Involved


The data structures used to hold all the address InformaAon: Struct sockaddr { unsigned short sa_family; char sa_data[14]; } Struct sockaddr_in { short sin_family; unsigned short sin_port; // Port Number struct in_addr sin_addr; // IP Address char sin_zero[8]; } Struct in_addr { unsigned long s_addr; // 4 bytes long }

Byte Ordering, as discussed in the morning session!


Byte ordering is the a^ribute of a system which indicates whether integers are stored / represented le_ to right or right to le_. Example 1: short int x = 0xAABB (hex) This can be stored in memory as 2 adjacent bytes as either (0xaa , 0xbb) or as (0xbb, 0xaa). Big Endian: Byte Value : [0xAA] [0xBB] Memory : [ 0 ] [ 1 ] Li^le Endian: Byte Value : [0xBB] [0xAA] Memory : [ 0 ] [ 1 ]

Byte Ordering
Example 2: int x = 0xAABBCCDD This 4 byte long integer can be represented in the same 2 orderings: Big Endian: Byte Value: [0xAA] [0xBB] [0xCC] [0xDD] Memory: [ 0 ] [ 1 ] [ 2 ] [ 3 ] Li^le Endian: Byte Value: [0xDD] [0xCC] [0xBB] [0xAA] Memory: [ 0 ] [ 1 ] [ 2 ] [ 3 ] All Network data is sent in Big Endian format. In the networking world we call this representaAon as Network Byte Order and naAve representaAon on the host as Host Byte Order. Where needed, we convert all data into Network Byte Order before transmission.

Common Six of the Many UAlity FuncAons


Byte Ordering: Host Byte Order to Network Byte Order: htons() , htonl() Network Byte Order to Host Byte Order: ntohs() , ntohl() IP Address format: Ascii do^ed to Binary: inet_aton() Binary to Ascii do^ed: inet_ntoa()

Involved System Calls: Summary


Socket() Bind() Listen() Accept() Connect() Read() / Send() / Sendto() Write() / Recv() / Recvfrom() Close()

Socket() for CreaAng a ConnecAon Endpoint


This creates an endpoint for a network connecAon. Int Socket(int doman, int type, int protocol) domain = PF_INET (IPv4 communicaAon) type = SOCK_STREAM (TCP) , SOCK_DGRAM (UDP) protocol = 0 (a random choice here for this class!)

Example: socket(PF_INET, SOCK_STREAM, 0);


This creates a TCP socket.

The call returns a socket descriptor on success OR -1 on an error.

Bind() for A^aching to an IP and Port


A server process calls bind to a^ach itself to a specic port and IP address.
Int Bind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen) sockfd = socket descriptor returned by socket() my_addr = pointer to a valid sockaddr_in structure cast as a sockaddr * pointer addrlen = length of the sockaddr_in structure

Example:

struct sockaddr_in my; my.sin_family = PF_INET; my.sin_port = htons(80); my.sin_addr.s_addr = INADDR_ANY; bzero(&my, 8) bind(sock, (struct sockaddr *)&my, sizeof(my));

Listen() for making Server Wait for a connecAon


The server process calls listen to tell the kernel to iniAalize a wait queue of connecAons for this socket. Int Listen(int sock, int backlog) sock = socket returned by socket() backlog = Maximum length of the pending connecAons queue Example: Listen(sock, 10); This will allow a maximum of 10 connecAons to be in pending state.

Accept() for a new connecAon !


Accept is called by a Server process to accept new connecAons from new clients trying to connect to the server. Int Accept(int socket, (struct sockaddr *)&client, socklen_t *client_len) socket = the socket in listen state client = will hold the new clients informaAon when accept returns client_len = pointer to size of the client structure Example : struct sockaddr_in client; int len = sizeof(client); Accept(sock, (struct sockaddr *)&client, &len);

Connect() for connecAng to a service


Connect is called by a client to connect to a server port. Int Connect(int sock, (struct sockaddr *)&server_addr, socklen_t len) sock: a socket returned by socket() server_addr: a sockaddr_in struct pointer lled with all the remote server details and cast as a sockaddr struct pointer len: size of the server_addr struct Example: connect(sock, (struct sockaddr *)server_addr, len);

Send / Recv for Data Transfer


Send(), Recv() , Read() , Write() etc calls are used to send and receive data . Int send(int sock, void *mesg, size_t len, int ags) Int recv(int sock, void *mesg, size_t len, int ags) sock = A connected socket mesg = Pointer to a buer to send/receive data from/in . len = Size of the message buer ags = 0 (for our purpose) The return value is the number of bytes actually sent/received. Example: char send_buer[1024]; char recv_buer[1024]; int sent_bytes; int recvd_bytes; sent_bytes = send(sock, send_buer, 1024, 0); recvd_bytes = recv(sock, recv_buer, 1024, 0);

Close() for Closing the ConnecAon


Close signals the end of communicaAon between a server-client pair. This eecAvely closes the socket. Int close(int sock) sock = the socket to close Example : close(sock);

Summarizing Networking in Linux Environment


Support Mechanism may be of
Network-oriented communicaAon Inter-Process CommunicaAon

May involve:
A Special Kind of Pipe Support for required Address Family Support for required Protocol Family & Socket Type

Address Family UNIX INET AX25 IPX APPLETALK INET6

Description Unix domain sockets Internet address family support TCP(UDP)/IP Amateur radio X25 Novell IPX Appletalk DDP Internet address family support TCP(UDP)/ IPv6

Socket Type Stream Datagram Reliable Delivered Messages Sequenced Packet

Description Reliable, Sequenced, Like TCP Unreliable, Not sequenced, Like UDP Like datagram but reliable Like Stream but fixed size packet

Network Applications

User Kernel

BSD Sockets Socket Interface INET Sockets

TCP Protocol Layers IP Network Devices PPP SLIP

UDP

ARP

Ethernet

The INET Layer


BSD Socket
A part of VFS inode A socket can be operated just the same as a le by system call read(), write(), lseek()

INET Layer use sock data structure to handle BSD socket

Lets look at some C code that was used for creaAon of a TCP-based Echo Server program!

A TCP-based Echo Server, wri^en in C

A TCP-based Echo Server .

A TCP-based Echo Server .

Lets look at some more C code that was used for creaAon of a TCP-based Echo Client program!

This is how a C program for NS lookup may look like!

A TCP-based Echo Client, wri^en in C

A TCP-based Echo Client

Where to nd more help?


A good introducAon to sockets programming in C is TCP/IP Sockets in C , by Michael J. Donahoo and Kenneth L. Calvert (Morgan-Kaufmann, 2001). The UNIX Systems Support Group document Network Layers explains the funcAons of the lower network layers. The Transmission Control Protocol (TCP) is covered in RFC 793. The User Datagram Protocol (UDP) is the subject of RFC 768. You can nd a list of widely used port assignments at the IANA (Internet Assigned Numbers Authority) Web site. And, then, you have books by W. Richard Stevens and Doug Comer as discussed in the morning session!

A UDP Server Client InteracAon

Interaction Points
Briefly revisiting the TCP/IP Architecture Current State-of-the-art and Evolving Research Directions
From Clusters and Grids to Clouds Wearable Computing Ubiquitous or Pervasive Computing

Select References to the literature Summary

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Interaction Points
Current State-of-the-art and Evolving Research Directions From Clusters and Grids to Clouds Wearable Computing Ubiquitous or Pervasive Computing Select References to the literature Summary

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Networks: A set of autonomous compute/communicaAon nodes interconnected for the purpose of meaningful resource sharing, require supporAng protocol stacks, not transparent to the users Clusters Homogeneous (plaxorm / OS), all involved nodes o_en belong to a single enAty and frequently designed for high-performance compuAng, may be limited to one or more racks within the same room (example: HPC clusters), easiest to deploy and manage Grids O_en heterogeneous (plaxorm / OS), Frequently spread over mulAple networks and network types, may involve single or mulAple organizaAons, require greater eort in deployment and administraAon Clouds May be public, private and hybrid, support mulAple levels of abstracAons / virtualizaAon, typically spread over wide areas, expected to be transparent to the user, oer the highest levels of redundancy / availability,

(c) Dr. Rahul Banerjee, BITS Pilani , INDIA

January 30, 2013

Of Clusters, Grids and Clouds A brief introducAon

(c) Dr. Rahul Banerjee, BITS Pilani , INDIA

VirtualizaAon is the underlying common technology involved in all the three paradigms Networking is the key enabler ingredient in each of these cases Cost-eecAveness, robustness and scalability improve as we move from cluster to cloud but overheads and internal complexity add up

January 30, 2013

A few points of signicance

Types of Clouds: ClassicaAon-1 <basis: model of operaAon>


Public Clouds (mulA-tenancy, wide variaAons, mulA- service, on-demand capacity addiAon a common feature) Private Clouds (single tenancy, limited variaAons, higher capital investments, greater control, more secure) Hybrid Clouds (near-opAmal best of both worlds, if congured well)

Types of Clouds: ClassicaAon-2 <basis: device virtualizaAon>


Infrastructure Cloud, ComputaAonal Cloud etc.

Types of Clouds: ClassicaAon-3 < basis: service virtualizaAon>


Plaxorm as a service, So_ware as a service, Storage as a service, CollaboraAon & Sharing Services etc.

(c) Dr. Rahul Banerjee, BITS Pilani , INDIA

January 30, 2013

Types of Clouds & Associated VirtualizaAon

Case-Study of of a Network-Based MulA-site CollaboraAon System Design

Project BITS-Connect 2.0

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Wearable CompuAng Elements

January 30, 2013

(c) Dr. Rahul Banerjee, BITS Pilani, INDIA

Paradiso & Starners Shoes <1995> for Electrical Energy GeneraAon

January 30, 2013

(c) Dr. Rahul Banerjee, BITS Pilani, INDIA

Pervasive CompuAng with AR

January 30, 2013

(c) Dr. Rahul Banerjee, BITS Pilani, INDIA

References
Larry L. Peterson & Bruce S. Davie: Computer Networks: A Systems Approach, Fifth Edition, Morgan Kaufmann / Elsevier, New Delhi, 2011. <System design approach> S. Keshav: Computer Networking: An Engineering Approach, Pearson Education, New Delhi, 1997. A. S. Tanenbaum: Computer Networks, Fifth Edition, Pearson Education, New Delhi, 2012. <Conceptual Approach> Y. Zheng and S. Akhtar: Networks for Computer Scientists and Engineers, Oxford University Press, New York, 2002. <Structural approach> A. Leon Garcia and I. Widjaja: Communication Networks: Fundamental Concepts and Key Architectures, Second Edition, Tata McGraw-Hill, New Delhi, 2004. Mohammed G. Gouda: Elements of Network Protocol Design, Wiley Student Edition, John Wiley & Sons (Pte.) Ltd., Singapore, 2004. Thomas G. Robertazzi: Computer Networks and Systems: Queuing Theory and Performance Evaluation, Third Edition, Springer-Verlag, New York, 2000. <Analytical approach>

30/01/13

(c) Dr. Rahul Banerjee, BITS Pilani, INDIA

52

What is next?
Subsequent lectures shall introduce you to the following topics: <not in the same order necessarily>
Topologies involved Performance
Quality of Service Reliability Security

Protocols and Mechanisms involved Methods of SimulaAon Se}ng up a physical system and conguring it Network Analysis

30/01/13

(c) Dr. Rahul Banerjee, BITS Pilani, INDIA

53

References
Larry L. Peterson & Bruce S. Davie: Computer Networks: A Systems Approach, Fifth Edition, Morgan Kaufmann / Elsevier, New Delhi, 2011. <System design approach> S. Keshav: Computer Networking: An Engineering Approach, Pearson Education, New Delhi, 1997. A. S. Tanenbaum: Computer Networks, Fifth Edition, Pearson Education, New Delhi, 2012. <Conceptual Approach> Y. Zheng and S. Akhtar: Networks for Computer Scientists and Engineers, Oxford University Press, New York, 2002. <Structural approach> A. Leon Garcia and I. Widjaja: Communication Networks: Fundamental Concepts and Key Architectures, Second Edition, Tata McGraw-Hill, New Delhi, 2004. Mohammed G. Gouda: Elements of Network Protocol Design, Wiley Student Edition, John Wiley & Sons (Pte.) Ltd., Singapore, 2004. Thomas G. Robertazzi: Computer Networks and Systems: Queuing Theory and Performance Evaluation, Third Edition, Springer-Verlag, New York, 2000. <Analytical approach>

30/01/13

(c) Dr. Rahul BRahul anerjee, BITS Pilani, INDIA Dr. Banerjee, BITS, Pilani (India)

54

Thank you for your kind attention!


BITS Pilani
Pilani | Dubai | Goa | Hyderabad

Rahul Banerjee

CreaAng a BSD Socket


For both client and server: Syntax takes the form:
int socket(int family, int type, int protocol) e.g. fd=Socket(AF_INET, SOCK_STREAM,0);

files_struct
count close_on_exec open_fs fd[0] fd[1]

file
f_mode f_pos f_flags f_count f_owner f_op f_inode f_version

fd[255]

inode
socket
type protocol data (sk)

BSD Socket File Operations lseek read write select ioctl close fasync

SOCK_STREAM

SOCK_STREAM Address Family socket operations

sock
type protocol socket

Linux BSD Socket Data Structure

Binding an Address
Only for Server: Int bind(int sockfd, const struct sockaddr *address, size_t add_len) Port Number is opAonal for binding socket.socket_state = TCP_CLOSE; The bound socket cant be used for other communicaAon

Binding an Address (cont.)


The bound addr was saved in sock.rcv_saddr UDP maintains a hash table udp_hash to allocate UDP port TCP doesnt add the binding sock to hash table during binding operaAon

Listening
Only for server: int listen(int sockfd, int queue_size) socket.socket_state = TCP_LISTEN;
Adds the sock to tcp_bound_hash and tcp_listening_hash

A_er receiving clients request:


Server builds a new sock Server clones the incoming sk_bu
and

queues it to the listening sock.receive_queue

ConnecAng
Only for client: Before connecAng, socket.socket_state = SS_UNCONNECTED;
Int connect(int csockfd, const struct sockaddr *address, size_t add_len) Adds the sock to tcp_listening_hash waiAng for servers response

AccepAng
Only for server: int accept(int sockfd, struct sockaddr *address, size_t *add_len) A new socket gets cloned from the listening socket If there are no incoming connecAon to accept
Non-Blockingaccept operaAon failed and throw away the new socket Blockingaccept operaAon was added to the wait queue

next

sk_buer structure

prev dev

head data tail end


truesize

len

Packet to be transmitted

Push Pull Put Trim

How does a WAN Look Like?

30/01/13

(c) Dr. Rahul Banerjee, BITS Pilani, INDIA

64

Architecture of the Internet 1 of 2


Brief Historical Notes:
Initiated by the US Department of Defense (DoD) through its Advanced Research Project Agency (ARPA) and was hence called ARPANet. Originally, it was a point-to-point WAN involving only four nodes across the USA. Original architecture that led to ARPANET has evolved over the years that have passed by. In later years, ARPA / DARPA dissociated with it and allowed to this to be blossomed into the Global Public Internet as we see it now.

Current Status:
It is loosely hierarchical. Has no single body that owns it or rigidly controls it. --Mostly run through volunteer efforts and by consensus. Runs several services, in a distributed manner, including the immensely popular World-Wide Web. Is helped by global cooperation including those from governments and corporates apart academia 30/01/13 (c) Dr. Rahul Banerjee, BITS Pilani, from INDIA 65

Architecture of the Internet 2 of 2


Currently, Internet architecture is designed for the besteffort delivery and is largely governed by the IAB of the Internet Society (ISoc).
ISoc has many sub-organs which facilitate evolution and coordinated maintenance of the Internet. IESG steers the ISoc in a general way the engineering issues are resolved. IETF workgroups do the ground work and by a democratic process helps community in building up engineering solutions through IETF drafts and standards (RFCs) etc.

Currently, the TCP/IP stack is the dominant protocol stack over which the Internet runs. Keeping the needs of expansion and improvement, this protocol family has continually evolved over last 30+ years.
Current version of IP is IPv6, although IPv4 is still dominant in use.
(c) Dr. Rahul Banerjee, BITS Pilani, INDIA

30/01/13

66

What is the Internet today?


Wide Area Network of variety of networks Global Public Not transparent, as yet Hybrid topology but largely hierarchical No single controller Internet Society (ISoc) oversees, assists --does not control QoS, Security continue to have issues partly at least Web, mail, commerce, education, entertainment, sharing continue to dominate its application space
30/01/13 (c) Dr. Rahul Banerjee, BITS Pilani, INDIA 67

Project BITS-Connect 2.0 The Immersive Tele-presence Rooms


This is how an 18-seater immersive telepresence room looks like at all the Indian campuses. Chancellors oce is equipped with one two-seater system

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

A Few More Networking Terms


Repeaters / Repeater Hubs / Shared Hubs: where usually Physical layer / level exist with L1-protocol data unit (raw bits) regeneration and onward transmission Managed Hubs / Layer-2 Switching Hubs: where Physical and Data Link layers / levels exist with ability to handle and deliver Layer-2-protocol data unit (frame) Bridges: where Physical and Data Link layers / levels exist with L2protocol data unit (frame) processing and forwarding Switches: where Physical and Data Link and / or Network (sometimes even higher) layers / levels exist with Layer-2 and / or Layer-3-protocol data unit (frame / packet) processing, switched routing / forwarding Routers: where Physical and Data Link and Network layers / levels exist with L3-protocol data unit (packet) processing, routing and forwarding Gateways: where two or more different networks meet and may require protocol / message translation capabilities Clouds: abstraction of node connectivity in the networking context <details hidden>
(c) Dr. Rahul Banerjee, BITS, Pilani, India 69

A Bus Topology based Computer Network

SHARED BUS

N1

N2

N3

N4

(c) Dr. Rahul Banerjee, BITS-Pilani, INDIA

70

The original Ethernet protocol proposed and implemented by Robert Metcafe was actually based on 1-p CSMA/CD protocol It did have a scheme that allowed greedy access to the channel by a station which led to lower efficiency Schemes like Random Back-off / Exponential Backoff were devised to improve the efficiency to a certain extent

Robert Metcafes Ethernet

30/01/13

(c) Dr. Rahul Banerjee, SDET Unit, BITS-Pilani, INDIA

71

An Ethernet LAN
Personal Computer WorkstaAon Workstation WorkstaAon

72

(c) Dr. Rahul Banerjee, BITS, Pilani, India

A Star Topology based Computer Network


N1
C

N4

S
N3

N2
Switch

(c) Dr. Rahul Banerjee, BITS-Pilani, INDIA

C
73

An Example of a Hybrid Switching Fabric


Electronic Switches Linecard 1 Linecard 2 Linecard L Group 1 Linecard 1 Linecard 2 Linecard L Group 2 Linecard 1 Linecard 2 Linecard L Group G LxM Crossbar
1 2 3 M 1 2

Fixed Lasers
1 2

Static MEMS GxG MEMS 1


M 1 2 3

Optical Electronic Receivers Switches Linecard 1 MxL Crossbar Linecard 2 Linecard L Group 1 2
1 2 3

LxM Crossbar

GxG MEMS

Linecard 1 MxL Crossbar Linecard 2 Linecard L Group 2

LxM Crossbar

3 M

GxG MEMS 3

1 2 3 M

Linecard 1 MxL Crossbar Linecard 2 Linecard L Group G

GxG MEMS M

Dr. Nick McKeown, Stanford University <modified version>

Another Form of Ethernet LAN


Personal Computer Tablet PC WorkstaAon WorkstaAon Network Printer Laptop Computer WorkstaAon The Ethernet Switch
(c) Dr. Rahul Banerjee, BITS, Pilani, India

75

A Tree Topology based Computer Network


NC12 NC21

NC11 NC1 NC2

NC22

NR

(c) Dr. Rahul Banerjee, BITS-Pilani, INDIA

76

A Ring Topology based Computer Network


C C

(c) Dr. Rahul Banerjee, BITS-Pilani, INDIA

C C
77

A Ring Topology based Computer Network


C C

(c) Dr. Rahul Banerjee, BITS-Pilani, INDIA

C C
78

Summary of Network Topologies


Bus Topology
Shared Switched

Tree Topology Ring Topology


Single Double

Star Topology Irregular Topology Complete Topology


(c) Dr. Rahul Banerjee, BITS, Pilani, India 79

Frames: Link Layer (L-2) Data Units


Frame
The unit of Data as expressed at the Data Link Layer (Layer-2 of the HypotheHcal model used for instrucHon) is convenAonally called a Frame.

Frames can take dierent formats and sizes depending upon the protocol in quesAon Frames do include elds like synchronizaAon, addressing, payload, control-informaAon etc. Frame Forwarding
The process of moving frames from one port to another in a bridge or switch.
80 (c) Dr. Rahul Banerjee, BITS, Pilani, India

Frames: Factors that ma^er!


Synchronization: Transmitter & Receiver need to be in sync Start Delimiter: Required to mark starting bit End Delimiter: Required to mark the end bit Control Information: Information suggesting data handling and interpretation Error Detection / Correction / Retransmission Flow Control: Required for avoiding data loss due to overflow at receiving end Data Length: Needed if data-field is not of fixed size
81 (c) Dr. Rahul Banerjee, BITS, Pilani, India

A Sample Frame Format



n-Byte Preamble Start-of -Frame Delimiter DesAnaAon Add. Source Address Length of Data Data Field Pad Field Checksum

82

(c) Dr. Rahul Banerjee, BITS, Pilani, India

Logical View of a 10-Gbps Unit


Frame Structure - 10 Gigabit Ethernet (IEEE 802.3ae for LAN, WAN and MAN) It uses the same MAC frame as the Ethernet. 46=<15 00 Data unit + pad 7 Pre 1 SFD 6 DA 6 SA 2 Length Type 4 FCS

h^p://www.javvin.com/pics/10GigE.gif&imgrefurl=h^p://www.javvin.com/protocol10GigE.html&usg=__VuNx4T-UphUAzm- _AEsDqMqvzLQ=&h=374&w=576&sz=34&hl=en&start=10&um=1&itbs=1&tbnid=JlvKsLiP2xuOfM:&tbnh=87&tbnw=134&prev=/images%3Fq%3Dgigabit%2Bethernet%26hl%3Den%26safe%3Do%26um%3D1

h^p://www.ovislinkcorp.co.uk/linkd.GIF

Summary of Dierences Between L-2 Switches, Routers (L-3) and L-3 Switches
Bridges and Layer-2 switches divide the network into segments or micro-segments (apart from helping in Layer-2 protocol translaAon, management, security etc.) In eect, we can say that
Layer-2 Switches / Bridges separate collision domains Layer-2 Switches / Bridges can carry out protocol translaAons
30/01/13 (c) Dr. Rahul Banerjee, SDET Unit, BITS- Pilani, INDIA 84

Summary of Dierences Between L-2 Switches, Routers (L-3) and L-3 Switches
Routers are Layer-3 devices who handle Layer-3 packet rouAng within and outside the local network / internetwork and therefore eecAvely separate broadcast domains which end at its dierent network interfaces each of which carries a separate Subnet-idenAer / Subnet-address (apart from Layer-3 protocol translaAon, monitoring, security and management) Thus, in eect, we can say that:
Routers Separate broadcast domains (each of such broadcast domains which end at its dierent network interfaces each of which carries a separate Subnet-idenAer / Subnet-address ) Routers can carry out interior rouAng and / or exterior rouAng, depending upon their locaAon in the network Routers can carry out protocol translaAons (in terms of protocol-specic packet formats as well as in terms of allowing appropriately forma^ed selecAve data specic to rouAng protocols they may support).
30/01/13 (c) Dr. Rahul Banerjee, SDET Unit, BITS- Pilani, INDIA 85

Summary of Dierences Between L-2 Switches, Routers (L-3) and L-3 Switches
Layer-3 switches are devices which can handle all funcAonaliAes of Layer-2 Switches as well as fast (o_en based on header/tag/label switching) Layer-3 packet rouAng within but not outside the local network / internetwork; and therefore, eecAvely separate broadcast domains which end at its dierent LAN interfaces each of which carries a separate Subnet-idenAer / Subnet- address (apart from opAonal Layer-3 protocol translaAon, monitoring, security and management) Thus, in eect, we can say that:
L-3 Switches Separate broadcast domains (each of such broadcast domains which end at its dierent LAN interfaces each of which carries a separate Subnet- idenAer / Subnet-address ) L-3 Switches can carry out fast interior rouAng / packet-switching o_en based on header/tag/label switching Layer-3 Switches, opAonally, can carry out protocol translaAons (in terms of protocol-specic packet formats).
30/01/13 (c) Dr. Rahul Banerjee, SDET Unit, BITS- Pilani, INDIA 86

Inside a Layer-2 Switch


Elements of a Layer-2 Switch
Processors (Front-end Processors on Line Cards) for Frame RouAng MulAple Buers for MulAple Queues Shared I/O Bus or Ring (1st / 2nd Gen.) / Switching Fabric (3rd Gen.) I/P Line Controllers (ILC) O/P Line Controllers (OLC)

87

(c) Dr. Rahul Banerjee, BITS, Pilani, India

Some More Terms of Relevance


Collision Domain The set of all stations connected to a network where faithful detection of a collision can occur. A collision domain terminates at a switch port. Late Collision A failure of the network in which the collision indication arrives too late in the frame transmission to be automatically dealt with by the medium access control (MAC) Protocol. The defective frame may not be detected by all stations requiring that the application layer detect and retransmit the lost frame, resulting in greatly reduced throughput. CRC Cyclic Redundancy Check is an error-checking technique used to ensure the fidelity of received data.
88 (c) Dr. Rahul Banerjee, BITS, Pilani, India

E-Fabric of a Wearable Garment

January 30, 2013

(c) Dr. Rahul Banerjee, BITS Pilani, INDIA

Wireless CommunicaAon in Wearables

January 30, 2013

(c) Dr. Rahul Banerjee, BITS Pilani, INDIA

User Interface & Sensors

January 30, 2013

(c) Dr. Rahul Banerjee, BITS Pilani, INDIA

TCP/IP Model
OSI TCP/IP
7 6 5 4 3 2 1 Application Presentation Session Transport Network Data Link Physical Transport Internet Host-toNetwork
TCP IP

Application

TCP Overview
TCP (Transmission Control Protocol)
ConnecAon-Oriented Reliable Protocol

UDP (User Datagram Protocol)


ConnecAonless Unreliable Protocol

IP Overview
32-bit Unique IP Address
Network Address Subnet Address Host Address
Gateway (Router) 140.112.28.XX 140.112.30.XX

You might also like