Professional Documents
Culture Documents
com
UDP
It is a connection less protocol
UDP is simple unreliable datagram protocol
s.
TCP
1.It is a connection oriented protocol
2.TCP is reliable byte stream protocol
co
te
no
ARP (Address resolution protocol):it is used to find the physical address if the ip address is
known.
RARP (Reverse address resolution protocol): it is used to find the ip address if the physical
address is known.
ar
3. What is IANA?
w.
5s
t
In well known port, port no and the port address are 16 bits.the range is from 0 to 1023.it is
assigned and controlled by IANA.It is used in server process.
5. Compare physical ,logical and port address?
Logical address
It belongs to network layer
This is a 32 bit address and is
uniquely identified between
the node and internet
Port address
It belongs to transport layer
This is a 16 bit address
ww
Physical address
1.It belongs to datalink layer
2.The size and format depends
on network
#include<stdio.h>
#include<conio.h>
Intmain(void)
www.5starnotes.com
www.5starnotes.com
Pid_t pid;
Pid=getpid( );
co
te
#include<conio.h>
Int main (void)
{
no
Pid_t pid;
w.
5s
t
Pid_getppid();
ar
Pid=fork ( )
If (pid==0)
s.
ww
In client server model two application program one running on local system (client) and another
running on remote system (server) need to communicate with one another. The communication
structure that we need in socket programming is socket.
www.5starnotes.com
www.5starnotes.com
3.Raw socket(SOCK_RAW)
Struct sockaddr_in
Uint8_t
sin_len;
Sa_family_t sin_family;
/*AF_INET*/
/*16 bit port addr*/
s.
In_port_t sin_port;
/*UNUSED FIELD*/
te
Char sin_zero[8];
}
{
In_addr_t s_addr;
ar
w.
5s
t
{
Unit8_t
no
Struct int_addr
};
#Define SIN6-LEN
struct sockaddr_in6
{
ww
Uint8_t
sin6_len;
Sa_family_t sin6_family;
In_port_t sin6_port;
Uint32_t
sin6_flowint
co
12. What are the data types used in client server program?
www.5starnotes.com
www.5starnotes.com
Description
Signed 8 bit integer
Header
<sys/types.h>
Uint8_t
<sys/types.h>
Int16_t
<sys/types.h>
Uint16_t
<sys/types.h>
Int32_t
<sys/types.h>
Uint32_t
<sys/types.h>
Sa_family_t
Socklen_t
<sys/soxcket.h>
In_addr_t
IPV4 address
<netinet/in.h>
In_port_t
no
co
s.
te
<sys/soxcket.h>
<netinet/in.h>
ar
Data types
Int8_t
Network byte order chooses its own byte order by the protocols used.it may be either LEBO or
BEBO.
w.
5s
t
15. What are the function designed for byte order transformation?
ww
They are,
www.5starnotes.com
www.5starnotes.com
co
The socket function returns a small non negative integer value,similar to a file descriptor.so we
call this to be socket descriptor.
s.
Syntax:
Int socket(int family,int type,int protocol);
17. What is the purpose of bind and connect?
te
BIND:Function is used to assign the local socket address to already created socket.
Syntax:
no
CONNECT:Functionn is used by TCP client to establish active connection with TCP server.
ar
Syntax:
w.
5s
t
LISTEN:Function enforce operating system that the server is ready to accept the connection
with TCP server.
Syntax: int listen(int sockfd,int backlog);
ACCEPT:Function is called by tcp server to return the next completed connection from of the
com[pleted connection queue.
Syntax: int accept(int sockfd,struct sockaddr cliaddr,sockaddrlen_t addrlen);
ww
www.5starnotes.com
www.5starnotes.com
Fork( ) causes the process to split into two identical process one retains the original process
identification number(PID) and is called parent,the other called child gets a new PID.
co
21. What are the functions used for byte manipulation operations?
Two groups of functions are for byte manipulation
B (byte)
s.
Bzero
Bcopy
te
Bcmp
Mem (memory)
no
Memset
Memcopy
ar
Memcmp
w.
5s
t
Socket is an abstraction through which an application may send and receive data in the same way
as an open file allows an application to read and write data to stable storage.
23. Compare various socket address structures?
IPV6
Length|AF-INETT
Length|AF_INET6
UNIX
SOPCKADDR_UN{}
Length|AF_LOCAL
DATALINK
SOCKADDR_DL{}
LENGTH|af_link
pathname(upto 104
bytes)
ww
IPV4
www.5starnotes.com
www.5starnotes.com
co
s.
ar
a.Process to process
no
te
Signal is a notification process that an event has occur. It is also called as software
interrupt. The signal can occur asynchronously. The process wont know the time exactly when
the signal has occur.
b.Kernel to process
w.
5s
t
4. Define Disposition.
Disposition is action associated with signal. We set the disposition of the signal.
We set the disposition of the signal by calling the sigaction function.
5.What are the three choices for disposition?
a. We can provide a function that is called whenever a specific signal occurs. This
action is called catching the signal.
b. Ignore the signal by setting its disposition to SIG_IGN
ww
c. We can set the default disposition for a signal by setting its disposition to
SIG_DFL
www.5starnotes.com
www.5starnotes.com
co
When ever a process finishes execution its parent will be modified by the kernel
by a SIGCHILD. The signal is generated automatically. The parent process will be
interrupted. The parent process may choose either ignore, go to system default or catch and
handle the signal.
s.
Slow system call is a system call that can block for an undetermined period of
time.
te
no
The wait function is used by parent process to wait for the child process to
complete or to terminate. The purpose of this wait is to avoid the child becoming the zombie
state.
ar
Waitpid specify which process to wait for and whether not to block.
Pid_t waitpid(pid_t pid,int *statloc, int options);
11. What is client termination?
w.
5s
t
When a client wants to terminate the connection it send FIN segment to signal
child. Whenever child is terminated the kernels automatically generate SIGCHILD to inform to
the parent that child is terminated.
12. Specify termination of server process?
* Crashing of server process
* Crashing of TCP server host
ww
14. What are the boundary conditions for crashing of TCP server host?
* The client host crashes
www.5starnotes.com
www.5starnotes.com
* The client process crashes
co
s.
Server is shutdown by the operator, when a UNIX system is shutdown, the iniit
process normally sends the SIGTERM signal to all process waits some fixed amount of time.
Then send SIGKILL signal to any process still running.
16. What is meant by polling ?
te
An application can lies in a loop calling recvfrom on a non blocking I/O model is
called polling
17.What is IO multiplexing model?
no
When select return the socket is readable, we can call recvfrom to copy the datagram into
application buffer
w.
5s
t
ar
18. Write any one advantage and disadvantage of I/O Multiplexing model?
Advt: Using select we can wait for more than one descriptor to be ready.
Disadvt: Instead of one system call we use two system calls select and recvfrom .
ww
*Synchronous I/O
*Asynchronous I/O
Eg: blocking, Non blocking, I/O multiplexing, signal driven multiplexing, signal driven I/O
model.
21. What is meant by asynchronous I/O with example?
www.5starnotes.com
www.5starnotes.com
It doesnt cause requesting process to be blocked.
co
Select function monitor several sockets at the same time. This function return
ready socket. Select function allows the process to instruct the kernel to wait for anyone of
multiple events to occur and to wake up the process only when one or more of the events occurs
or when a specific amount of time has passed.
s.
Int select(int maxfd1, fd_set *writeset, fd_set *exceptset, const struct timeval
te
*timeout);
Return positive count of ready descriptors
0 if an timeout
-1 if error
24. Define wait forever.
no
Wait forever returns only when one of the specified descriptor is ready for I/O.
25. What is Donot wait at all?
ar
Donot wait at all states that, return immediately after checking the descriptor.
Time out point to timeval structure. Timeval value must be zero.
26.What are the conditions of the descriptor to become ready?
w.
5s
t
27. What are the steps involved for socket has exception handling?
ww
www.5starnotes.com
www.5starnotes.com
SHUT DOWN
CLOSE FUNCTION
s.
co
te
Poll function test for events on multiple socket simultaneously. It should include
the following header file.
no
#include<poll.h>
ar
w.
5s
t
1.what are the various way to get and set the options that affect a socket?
The getsockopt and setsockopt functions
The fontl function and
The ioctl function
ww
sockfd->socket descriptor
level->integer that specifies the protocol specific code that interprets the option
www.5starnotes.com
www.5starnotes.com
co
Level->integer that specifies the protocol specific cod that inmtreprets the option
Sockfd->socket descriptor
Optvalue->pointr to the variable into which th current value of the option is stored
s.
4.what are the following socket options inherited by a connect tcp socket from the listening
socket?
no
te
SO_DEBUG,SO_DONTROUTE,SO_KEEPALIVE,SO_LINGER,SO_OOBINLINE,SO_RCVB
UF AND SO_SNDBUF.
They are protocol independent options and are handled by the protocol independent code within
the kernel.
ar
It supports the datagram sockets and they enable or disable the ability of process to send
broadcast messages.the application must set the option before sending the broadcast messages.
w.
5s
t
Only the tcp socket supports this.when this option is enabled,kernel key track of detailed
information about all packets sent or received by tcp for the socket.
8.What is the use of SO_DONTROUTE?
It specifies that the outgoing packets are to bypass the normal routing mechanism of the
underlying protocol.
ww
www.5starnotes.com
www.5starnotes.com
When this option is set,out of band data will be placed in the input sequence.
12. What is the function of SO_REUSEPORT?
s.
co
This socket option allows duplicate binding but only if each socket that wants to bind the same
address and port specify this socket option.
te
It is set for the raw IP socket.by using this,We can construct our own IP header for all the
datagram being sent by the raw socket.
no
This socket option are processed by ICMPV6 and has a level of ICMPV6.this sets the ICMPV6
filter structure. This structure specifies the 256 possible ICMP messages.they are passed to
socket through a raw socket.
ar
IPV6_ADDRFORM,IPV6_CHECKSUM<IPV6_DSTOPTS,IPV6_HOPLIMIT,IPV6_HOPOPT
S,IPV6_NEXTHOP,IPV6_PKTINFO,IPV4_PKTOPTIONS,IPV6_RTHDR,IPV6_UNICAST_H
OPS
17. What are the TCP options?
w.
5s
t
ww
If a given connection has out standing data then no small ackets will be sent on the
connection until exsisting data is acknowleged.
20. Define DNS
Domain name system (DNS) maps between hostnames and IPaddresses.
www.5starnotes.com
www.5starnotes.com
#A
co
# AAAA (quad A)
#PTR
#CNAME
23. Give the syntax of gethostname function
te
s.
#MX
no
This function takes the host name and finds the coresspondind=g binary IP address
from the hostent structure.
ar
General format:
w.
5s
t
Char*h_name;
Char*h_aliases;
Int h_addrtype;
Int h_length;
Char**h_addrr_list;
ww
www.5starnotes.com
www.5starnotes.com
co
Char*h_name;
char*h_aliases;
int h_addrtype;
s.
int h_length;
char**h_addr_list;
te
This function maps from the service name to the port number
no
General format:
Struct servant
{
w.
5s
t
Char*s_name;
ar
Char*s_aliases;
Int s_port;
Char*s_proto;
}
ww
General format:
Struct servant*getservname(int port,const char*protoname);
Struct servant
{
Char*s_port;
www.5starnotes.com
www.5starnotes.com
Char*s_aliases;
Int s_port;
Char*s_proto;
s.
co
te
no
ar
w.
5s
t
ww
www.5starnotes.com
www.5starnotes.com
s.
co
te
no
ar
w.
5s
t
12. What are the functions that are used to lock and unlock the mutex?
Int pthread_mutex_lock(pthread_mutex_t*mptr);
Int pthread_mutex_unlock(pthread_mutex_t*mptr);
Return 0 if ok
Positive exxx value on error.
ww
www.5starnotes.com
www.5starnotes.com
s.
co
te
no
ar
w.
5s
t
ww
www.5starnotes.com
www.5starnotes.com
co
It is a single operator interface with a powerful but user friendly set of commands
of performing most or all network management tasks.
s.
te
no
Management station
Management agent
ar
w.
5s
t
ww
Agent function gathers and records management information for one or more network
elements and communicates the information to the monitor.
www.5starnotes.com
www.5starnotes.com
Polling is a request response interaction between the manager and agent. The manager
Can query any agent and request the values of various information elements, the agent
co
s.
With event responding, the initiative is with the agent and the manager is in the role of
listener, waiting for incoming information, event reporting is useful for detecting problems.
A proxy is an SNMP agent that maintains information on the behalf of one more non
te
SNMP devices.
no
ar
The structure of management information defines the general framework within which a
MIB can be defined and constructed.
w.
5s
t
Object instance is a particular instance of an object type that has bound to a specific
value.
ww
State
Local IP address
Local port
Remote IP address
Remote port
www.5starnotes.com
www.5starnotes.com
co
Get
Set
Trap
te
s.
ar
no
The get request PDU is issued by an SNMP entity on behalf of a network management
station application. The sending entity includes the following fields in PDU: PDU type,
request_id, variable bindings. The receiving SNMP entity responds to a Get Request PDU with a
Get Response PDU containing the same request_id.
19. What are the limitations of using SNMP?
SNMP may not suitable for the management or truly large networks
because of the performance of polling.
ww
w.
5s
t
SNMP is not suited for retrieving large volume of data, such as entire
routing table.
The trap PDU is issued by an SNMP entity on behalf of a network management agent
application. It is used to provide the management station with an asynchronous notification of
some significant event.
21. What are the types of Threats?
www.5starnotes.com
www.5starnotes.com
Modification: An authorized party not only gains access but also tampers
with an asset. This is a threat to integrity.
s.
co
no
te
A=MTBF/MTBF+MTTR
ar
w.
5s
t
ww
Get: Enables the management station to retrieve the value of objects at the
agent
Set: Enables the management station to set the value of objects at the agent
Security
www.5starnotes.com
www.5starnotes.com
s.
co
Objects types
Simple/Tabular objects
Instance identification
no
te
ar
29. What are the key elements for TCP/IP network management?
Management station
Management agent
w.
5s
t
ww
www.5starnotes.com
ww
w.
5s
t
ar
no
te
s.
co
www.5starnotes.com
www.5starnotes.com