Presentation on theme: "Review: Name/Address conversion: –What does the domain name system do? –Which system calls use the domain name system? –How does it work? –How does getservbyname."— Presentation transcript:
Review: Name/Address conversion: –What does the domain name system do? –Which system calls use the domain name system? –How does it work? –How does getservbyname get the service information?
Todays topic: Out-of-band data. –What is out of band data? A communication channel can be used to transfer both regular data or control data. Control data (packets, signal) control the behavior of a communication channel. –E.g VC establishment packets in ATM are control packets. Control data usually need attention as soon as possible (have higher priority than regular data). In-band/out of band control data –Appear as regular data or appear differently –Use the same communication channel / use different communication channels – true out of band data need a separate communication channel.
Since it is typical to have control information passing around in a network, a communication channel usually needs to support out of band data. Handling out of band data is very system dependent. Focus on TCP out of band data. TCP does not have true out of band data. TCP emulates out of band data using the urgent mode.
Sending/Receiving out of band data in TCP: –int send(int s, const void *msg, int len, unsigned int flags); –int recv(int s, void *buf, int len, unsigned int flags); Flags = MSG_OOB What happens when issuing send (sockfd, a, 1, MSG_OOB)? The sender side: –An OOB byte a is appended to the end of the buffer –The urgent pointer is set to the next available location –The next segment will have its URG flag set in the TCP header (but may not have the actual OOB byte). »The urgent notification is always sent even if the OOB byte is not sent.
–What happens when issuing send (sockfd, a, 1, MSG_OOB)? The receiver side: –When receiving a segment with URG flag set, TCP checks whether it is a new out of band data (first time flag). Only the first segment is used to notify that new out of band data have arrived. –SIGURG is sent to the owner of the socket and if the process is blocked in a select waiting for an exception condition of the socket, the select returns. »At the time of notification, the data may or may not arrive. –When the actual OOB byte arrives, it can be pulled out of band or left inline. (SO_OOBINLINE). »TCP maintains one byte out of band buffer. »The byte can be retrieved by recv, recvfrom and recvmsg with MSG_OOB flag.
–What happens when issuing send (sockfd, abc, 3, MSG_OOB)? What is the OOB byte? –Following is a set of programs showing the behavior of TCP out of band data. See example1.c for sending OOB data See example2.c for notifying the arrival of out of band data through SIGURG. See example3.c for notifying the arrival of OOB byte through select. Notice the different behavior for linux of solaris for example3.c. What happens to the byte stream when OOB data are used? See example4.c and example5.c –What happens when two OOB bytes are sent?
–See example5-1.c for the use of OOBINLINE. –See example6.c and example7.c, what will be the outputs for example7.c?
–TCP out of band data summary: When is the notification of out of band data sent? When are the actual data sent? TCP has only one urgent pointer per connection: what is the implication? TCP has only one byte out of band data buffer, what is the implication? –An application of TCP OOB: Client-server heartbeat functions: figure out whether the client and the server are still connected. Example8.c and example9.c