Sunteți pe pagina 1din 9

BCS-061

Q. 1) Compare the security features, reliability approaches and delivery mechanisms of IPv4 and IPv6. Ans: Following are the differences and similarities between Ipv4 and Ipv6 Ipv4 Addresses are 32 bits (4 bytes) in length. Address (A) resource records in DNS to map host names to IPv4 addresses. Pointer (PTR) resource records in the IN-ADDR.ARPA DNS domain to map IPv4 addresses to host names. IPSec is optional and should be supported externally. Header does not identify packet flow for QoS handling by routers. Ipv6 Addresses are 128 bits (16 bytes) in length. Address (AAAA) resource records in DNS to map host names to IPv6 addresses. Pointer (PTR) resource records in the IP6.ARPA DNS domain to map IPv6 addresses to host names. IPSec support is not optional. Header contains Flow Label field, which Identifies packet flow for QoS handling by router.

1. 2.

1. 2.

3.

3.

4. 5.

4. 5.

Q. 2) Write a client and server program in C language using TCP via the reliable byte stream, where client program interact with the Server as given below: i) The server listens for connections on a defined port number and IP address. Server can listen for maximum 4 clients concurrently. Ans:
(i) /*Program code fragment*/ int main(void) { // does whatever initialization the framework needs server_init(); // starts 3 threads of the same code server_addThreads(3, threadFunc, "example thread"); // runs the server server_run(); // that's it! return 0; }

ii) Once the client is connected to the server, it sends a character string to the server.
Ans: /*Program code fragment*/ static threadfunc threadFunc(void* arg) { for (;;) { // uses "server_printf" (and not plain printf) because of // contention issues between threads server_printf("Hello from a minimal thread...\n"); server_sleep(3); } return 0; }

iii) Server reply with the palindrome of the given string to the client.
Ans: /*Program code fragment*/

int main(void) { // the port on which the server waits for connection requests server_setServicePort(12345); // how much detail is written to the log file server_setLogLevel(LOG_LEVEL_DEBUG); // does whatever initialization it's needed server_init(); // starts 5 threads of the same code server_addThreads(5, threadFunc, "example thread"); // runs the server server_run(); // that's it! return 0; }

iv) Client will send an acknowledgment to the server after receiving the correct answer. After receiving acknowledgement connection is shutdown by the server.
Ans: /*Program code fragment*/ static threadfunc threadFunc(void* arg) { Message *msg; for (;;) // the thread main loop { // waits for a message from a client msg = server_waitInputMessage(); server_logDebug("received a message"); // echoes back the received message server_logInfo("ok, replying"); server_dispatchOutputMessage(msg); } // yep, that's it! return 0; }

Q. 3) What is a Cookie? How is it important in session management? Ans: A cookie is a piece of information used for an origin website to send state information to a user's browser and for the browser to return the state information to the origin site. The state information can be used for authentication, identification of a user session, user's preferences, shopping cart contents, or anything else that can be accomplished through storing text data on the user's computer. When cookie-based session management is used, a message (cookie) containing user's information is sent to the browser by the Web server. This cookie is sent back to the server when the user tries to access certain pages. By sending back the cookie, the server is able to identify the user and retrieves the user's session from the session database; thus, maintaining the user's session. A cookie-based session ends when the user logs off or closes the browser. Cookie-based session management is secure and has performance benefits. Cookie-based session management is secure because it uses an identification tag that only flows over SSL. Cookie-based session management offers significant performance benefits because the WebSphere Commerce caching mechanism only supports cookie-based sessions, and not URL rewriting. Cookie-based session management is recommended for shopper sessions.

4) Compare and contrast Link State and Distance Vector Routing algorithms? Ans: "Distance Vector" and "Link State" are terms used to describe routing protocols which are used by routers to forward packets between networks. The terms distance vector and link state are used to group routing protocols into two broad categories based on whether the routing protocol selects the best routing path based on a distance metric (the distance) and an interface (the vector), or selects the best routing path by calculating the state of each link in a path and finding the path that has the lowest total metric to reach the destination. For example: If all routers were running a Distance Vector protocol, the path or 'route' chosen would be from A B directly over the ISDN serial link, even though that link is about 10 times slower than the indirect route from A C D B. A Link State protocol would choose the A C D B path because it's using a faster medium (100 Mb ethernet). In this example, it would be better to run a Link State routing protocol, but if all the links in the network are the same speed, then a Distance Vector protocol is better.

Comparison between Distance Vector and Link State

Q. 5) What is a mail server? Briefly explain specifying the protocols involved, how a sender can send a mail to the server and the recipient retrieves it from the server? Ans: A mail server is also known as a mail transfer agent or MTA, a mail transport agent, a mail router or an Internet mailer. It is an application that receives incoming e-mail from local users and remote senders and forwards outgoing e-mail for delivery. A computer dedicated to running such applications is also called a mail server. Microsoft Exchange, qmail, Exim and sendmail etc are some mail server programs. The mail server works in conjunction with other programs to make up what is sometimes referred to as a messaging system. A messaging system includes all the applications necessary to keep e-mail moving as it should. When we send an e-mail message, our e-mail program, such as Outlook or Eudora, forwards the message to our mail server, which in turn forwards it either to another mail server or to a holding area on the same server called a message store to be forwarded later. As a rule, the system uses SMTP (Simple Mail Transfer Protocol) or ESMTP (extended SMTP) for sending e-mail, and either POP3 (Post Office Protocol 3) or IMAP (Internet Message Access Protocol) for receiving e-mail.

Q. 6) Write an algorithm for implementing Sliding Windows protocol for flow control, where window size=1. The algorithm should be nearer to C language implementation. Ans: Following is the program for implementing sliding window protocol: SERVER
#include<stdio.h> #include<sys/socket.h> #include<sys/types.h> #include<netinet/in.h> #include<arpa/inet.h> #define SIZE 4 main() { int sfd,lfd,len,i,j,status; char str[20],frame[20],temp[20],ack[20]; struct sockaddr_in saddr,caddr; sfd=socket(AF_INET,SOCK_STREAM,0); if(sfd<0) perror("ERROR"); bzero(&saddr,sizeof(saddr)); saddr.sin_family=AF_INET; saddr.sin_addr.s_addr=htonl(INADDR_ANY); saddr.sin_port=htons(4980); if(bind(sfd,(struct sockaddr*)&saddr,sizeof(saddr))<0) perror("Bind Error"); listen(sfd,5); len=sizeof(&caddr); lfd=accept(sfd,(struct sockaddr*)&caddr,&len); printf("Enter the text\n"); scanf("%s",str); i=0;

while(i<strlen(str)) { memset(frame,0,20); strncpy(frame,str+i,SIZE); printf("Transmitting Frames"); len=strlen(frame); for(j=0;j<len;j++) { printf("%d",i+j); sprintf(temp,"%d",i+j); strcat(frame,temp); } printf("\n"); write(lfd,frame,sizeof(frame)); read(lfd,ack,20); sscanf(ack,"%d",&status); if(status==-1) printf("Transmission is successful\n"); else { printf("Received error in %d\n\n",status); printf("\n\nRetansmitting Frame"); for(j=0;;) { frame[j]=str[j+status]; j++; printf("%d",j+status); if((j+status)%4==0) break; } printf("\n"); frame[j]='\0'; len=strlen(frame); for(j=0;j<len;j++) { sprintf(temp,"%d",j+status); strcat(frame,temp); } write(lfd,frame,sizeof(frame)); } i+=SIZE; } write(lfd,"exit",sizeof("exit")); printf("Exiting\n"); sleep(2); close(lfd); close(sfd); }

CLIENT
#include<stdio.h> #include<sys/socket.h> #include<sys/types.h> #include<netinet/in.h> main() { int sfd,lfd,len,choice; char str[20],str1[20],err[20]; if(sfd<0) perror("FdError"); bzero(&saddr,sizeof(saddr)); saddr.sin_family=AF_INET; inet_pton(AF_INET,"a27.0.0.1",&saddr.sin_addr); saddr.sin_port=htons(4980); connect(sfd,(struct sockaddr*)&saddr,sizeof(saddr)); for(;;) { read(sfd,str,20); if(!strcmp(str,"exit")) { printf("Exiting\n"); break; } printf("\n\nReceived%s\n\n1.do u want to report an e rror(1-Yes 0- no)",str); scanf("%d",&choice); if(!choice) write(sfd,"-1",sizeof("-1")); else { printf("Enter the sequence no of the frame where error has occurred\n"); scanf("%s",err); write(sfd,err,sizeof(err)); read(sfd,str,20); printf("\n\nReceived the re-transmitted frames%s\n\n",str); } } }

Q. 7) Write short notes on following: (i) DNS (ii) WiMax

Ans: (i) DNS: The Domain Name System (DNS) is a hierarchical distributed naming system for computers, services, or any resource connected to the Internet or a private network. It associates various information with domain names assigned to each of the participating entities. Most importantly, it translates domain names meaningful to humans into the numerical identifiers associated with networking equipment for the purpose of locating and addressing these devices worldwide. For example, the domain name www.example.com translates to the addresses 192.0.43.10 (IPv4) and 2620:0:2d0:200::10 (IPv6).

(ii) WiMax: Wimax stands for Worldwide Interoperability for Microwave Access. It is a communication technology for wirelessly delivering high-speed Internet service to large geographical areas. It is a part of a fourth generation, or 4G, of wireless-communication technology, offering a metropolitan area network with a signal radius of about 50 km. Wimax offers data-transfer rates of up to 75 Mbit/s, which is superior to conventional cablemodem and DSL connections. However, the bandwidth must be split among multiple users and thus yields lower speeds in practice.
____________________________________________________________________________

CS-69
Q. 1) Describe the following: (i) DNS (ii) Name Resolution (iii) Subnet Masking (iv) Urgent Pointer Ans: (i) DNS: The Domain Name System (DNS) is a hierarchical distributed naming system for computers, services, or any resource connected to the Internet or a private network. It associates various information with domain names assigned to each of the participating entities. Most importantly, it translates domain names meaningful to humans into the numerical identifiers associated with networking equipment for the purpose of locating and addressing these devices worldwide. For example, the domain name www.example.com translates to the addresses 192.0.43.10 (IPv4) and 2620:0:2d0:200::10 (IPv6). (ii) Name Resolution: In computer networks, name resolution is used to find a lower level address (such as an IP address) that corresponds to a given higher level address (such as a hostname). Commands that allow name resolution are: nslookup and host. (iii) Subnet Masking: A Subnet mask is a 32-bit number that masks an IP address, and divides the IP address into network address and host address. Subnet Mask is made by setting network bits to all "1"s and setting host bits to all "0"s. Within a given network, two host addresses are reserved for special purpose. The "0" address is assigned a network address and "255" is assigned to a broadcast address, and they cannot be assigned to a host. Examples of commonly used netmasks for classed networks are 8-bits (Class A), 16-bits (Class B) and 24-bits (Class C). (iv) Urgent Pointer: The urgent pointer flag in the TCP Flag allows us to mark a segment of data as 'urgent', while this urgent pointer field specifies where exactly the urgent data ends. Example of usage of urgent pointer is as follows:

In this TCP segment, the URG flag has been set to 1 indicating that there is urgent data attached to this segment. Q. 2) How does the TCP handle the issue of multiplexing? Ans: A TCP multiplexing system improves the efficiency of the Web server farm or Internet service by acting as a thin connection (or channel) proxy to servers, caches and content

delivery networks. The system receives TCP/IP requests, consolidates them and applies logic to the opening and closing of server connections. It can direct and funnel client requests into high-speed server sessions that avoid the constant interruption of setup and tear down. When a user requests a Web page, his browser sends numerous requests for different types of information - such as Java applet, multimedia and database access - resulting in as many as 50 connection requests to Web servers. The server opens a socket and allocates memory and processes for that user, opens a session for the user, acknowledges the client's HTTP request, fetches relevant data from cache or disk memory, flows the data back to typically slow access connections and finally closes the session. TCP multiplexing systems keep client-side connections open with longer timeouts. By eliminating most of the "hello-goodbye" setup and tear down overhead so that transactions can flow freely over the WAN via managed server connections, these systems dramatically improve the efficiency of high-traffic Web sites and Internet services. The TCP multiplexing engine monitors each incoming and outgoing packet to manage sessions and determine when a connection can be used for another client. The server no longer has to expend its processing power setting up and tearing down sessions for each user request. It can also manage packets to protect against traffic spikes and attacks, provide access control and direct content delivery. Additionally, since client sessions are managed by the TCP multiplexing engine, the network overcomes the TCP slow-start overhead that is inherent to TCP/IP networking. The client is no longer required to wait while the server tries to gauge the quality of the client connection.

Q. 3) (i) Identify the address classes of the following IP address: (a) 255.255.190.0 (b) 216.111.52.12 (c) 150.156.10.10 (ii) Suppose the class B network uses 20 out of 32 bits to define a network address. How many Class B Network are possible in this case? (iii) The size of the option field of an IP diagram is 20 bytes. What is the value of HLEN field in binary? Ans: (a) 255.255.190.0 - Class E.

S-ar putea să vă placă și