Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An in-depth exploration of communication between processes using the osi model, focusing on tcp, udp, sctp, and ip. Topics include the standard protocol layers, their corresponding levels in the osi model, and the uses of unix commands like netstat, ifconfig, ping, and nslookup. Learn about the differences between tcp, udp, and sctp, as well as the role of ip addresses and port numbers in communication.
Typology: Exams
1 / 5
CSci 553: Spring 2006 Exam 2: Study Guide (UNP)Ch #1: Unix Network Programming · What is a protocol? · Know what the basic client/server model entails. How does it organize communication between processes? · What are the standard 7 OSI model protocol layers? · What level do TCP, UDP and SCTP correspond to in the OSI model? · What layer does IP correspond to in the OSI model? · What level are protocol specifications such as http, imap and pop based at in the OSI model? · Do you know the basic uses of the unix commands netstat, ifconfig, ping and nslookup? · Can a host have more than 1 network interface (hint yes it can). How would you determine the IP addresses of the network interfaces for a host? A host having more than 1 network interface is referred to as being multi-homed. · Be aware of the special interface, known as the loopback interface. A host using TCP/IP always supports the loopback interface. The host is not considered multi- homed because it has the loopback interface and one other real interface, it must have 2 real interfaces besides the loopback interface to be multi-homed. The loopback interface is always associated with the special IPv4 address: 127.0.0. (UNP) Ch #2: Transport Layer: Details of TCP, UDP and SCTP transport layer protocols · UDP is: · A simple, unreliable datagram protocol · only sends packets (datagrams) over established link · no guarantee that package will arrive · TCP is: · A reliable byte-stream protocol · send (and receive) a strem of bytes · TCP handles breaking stream into packets, sending and reassembling them · TCP is reliable, makes sure all packets successfully transmitted, automatically detects and retransmits lost packets as well as ignoring duplicates and assembling stream back in correct order · SCTP is: · a newer transport layer developed with telephony application and IPv6 in mind. · similar to TCP as it is reliable and connection oriented · Provides message boundaries and other improvements over TCP · We also talked about IP the Internet Protocol at the networking layer of the protocol stack. · Do you know the main difference between IPv6 and IPv4? · Would you recognize an IPv4 internet address? an IPv6 address? · Be sure you understand the TCP 3-way handshake and connection closing · Do you understand the purpose of the timing diagrams for connection establishment and closing?
· Do you understand the TCP state transition diagram (pg 41, fig 2.4) for the TCP protocol establishment and closing processes? If you saw these states using the netstat command, would you be able to understand where in the state transition diagram the connection process is? · Besides the the IP address, UDP, TCP and SCTP also require a port number to completely identify the socket for sending/receiving communication to/from a host. · This is because at any time, many applications on the host might be using the UDP, TCP or SCTP protocols to communicate, do you understand why port numbers are necessary in this case? · Standard services have well-known port numbers, which are in the range from 1 to 1024, and have been assigned and are used by convention for standard services such as http, ftp, ssh, imap, etc · When creating a server, we usually specify the port number to use explicitly, because we want to communicate at a standard location on the host so that clients can find our service · Conversely, a client often does not specify the port number. When a port number is not specified when creating a socket, the OS assigns one from a range of port number for that purpose, known as dynamic or ephemeral port numbers, usually > 49152 (but exact range is dependent on OS implementation). · A socket pair for a TCP connection is a four-tuple that defines the two endpoints of a connection (client IP, client port, server IP, server port) · What is the difference between a concurrent server and a sequential server? · We studied using fork() system call to implement concurrent servers in Unix, how else could we handle multiple clients concurrently? · Do you understand the dynamics of the process of how a child process for a concurrent server is able to be created and communicate with a single client over a socket pair, while the parent server can still accept connections on the server port number from new clients? (AUP) Ch #5: Art of protocol design · Basic problem in communicating data over network is we need to flatten (serialize) data so we can squirt it over a pipe as a serial byte stream · Similar problem to creating a file format for storing data in a file system · Both involve serialization of in-memory data structures · The problem is called variously: marshaling/unmarshaling, pickling/unpickling (python), ObjectOutputStream/ObjectInputStream (java) · We should not simply concentrate on storage transaction/economy when designing protocols. · 4 themes/tradeoffs when desiging a protocol
· Do you understand the basics of the SMTP, POP and IMAP protocols that we examined in this section? · Textual · command-argument format of requests · payload consists of a DATA command terminated by some indicator, like a line consisting of a single dot, or by sending the length of the DATA payload first · Use sequence labels, sometimes, · Use human readable response messages (along with response codes) for both easy human interaction and debugging of the server as well as simple parsing. (UNP) Ch #3: Introduction to Socket details · Socket address structure is fundamental, most socket functions require a socket address structure · Each supported protocol defines its own socket address struct, · IPv4 sockaddr · sockaddr_in · /usr/include/netinet/in.h · generic socket address structure used for socket functions that must deal with any of the supported protocol families · consists of the common data which is the address family and length of the structures · Byte ordering functions are needed because of big-endian/little-endian differences in representing byte ordering in different machine architectures. · ntohl · ntohs · htonl · htons · where n stands for network byte ordering, and h for host byte ordering, and thse convert a short or long from network to host ordering, and vice-versa · Byte manipulation functions are needed in order to correctly set up or clear out structures, can't rely on C convention of null-termianted string, so can't use cstring library functions: · bzero · bcopy · bcmp · memset · memcpy · memcmp · The mem variants are the newer, prefered versions defined in POSIX standards · Converstion functions from strings to ip addresses: · inet_aton · inet_addr · inet_ntoa · Convert internet addresses between ASCII strings and network byte ordered binary values.
(UNP) Ch #4: Elementary TCP sockets · TCP sockets, both client and server first call the socket() function · returns a byte-stream description, which will be used to read and write the bytes sent out over the socket · Client · calls connect() to establish a connection with a TCP server · must supply the sockaddr struct which contains address of server we are attempting to communicate with · Server · after opening socket calls: · bind() to assign a local protocol address to a socket (e.g. binds to the well- known port number for the service) · listen() to convert an unconnected (active) socket to a passive socket · then accept() causes server to wait for next incoming connection request on the connection queue. · Concurrent server issues · need to handle multiple clients, concurrently · We can create a separate child process using fork() system call, easy to do in unix where process creation is cheap · We could use threads, where each separate thread within the process handles communication with the child · fork() · called once, but returns twice, once in the new child process and once in the parent process · returns a pid of 0 in the new child process · returns the pid of the new child process created in the parent process · all open descriptors are copied and usable in the child process, including the newly accepted socket descriptor · read() write() · once TCP connection established, used read() and write() type methods on the socket descriptor to send data back and forth between client and server · close() · can explicitly close() the connection between client and server by calling close() on the socket descriptor. The client or the server can initiate the termination, it doesn't matter, TCP handles termination either way. (UNP) Ch #5: Signal handling and managing child processes created using fork for a concurrent server · While using fork() can be simple, to do it completely correctly for a production scale server, we must carefully handle child processes to close them correctly, to make sure they do not stay in the system as zombies and clog up the process tables. · A signal is a notification to a process that an event has occurred · Considered a type of software interrupt. · POSIX standard is defined for signal types and handling · SIGCHLD signal is sent by the kernel to a parent process whenever a child process of that parent is terminating
· signals are not buffered, so multiple signals happening rapidly may cause some of them to be lost and not all of them to be delivered, which is a problem... · Every signal has a disposition · On receipt of a signal, a function can be called inside of the process to handle the signal · The signal can be ignore (with some exceptions, like SIGKILL and SIGSTOP) · Can use a default disposition, which is defined as having the process terminate immediately for most signals. · signal() function old style for setting disposition, POSIX standard defines the sigaction() function, which is slightly more complicated to use. · 2 issues when handling signals in a concurrent server · signals are not reliable, as we said above, so must handle case were not all terminating child process cause a reliable signal to be delivered to the parent · Signals that interrupt a blocked system call can cause problems in some environments, some OS will automatically restart the system call, but some will not · need to use wait() or waitpid() to get the final termination status of a child · need to use waitpid() in a loop in order to correctly handle lost signals. Do you understand why the loop is necessary here to handle child termination signals correctly? (UNP) Ch #8: Elementary UDP sockets · Do you know the difference when calling the socket() function to specify that we want a UDP soceket rather than a TCP socket? · UDP sockets are simpler, do not establish a lasting connection · use sendto and recvfrom to send datagrams over the UDP socket