Download presentation
Presentation is loading. Please wait.
Published byJeffery Ray Modified over 9 years ago
1
Review: –Concurrent server and multiplexed server How they work? Which one is better?
2
Today’s topic: How to compile non ansi features with the – ansi flag without warning. How to find the libraries needed to compile a program. Preforked server Introduction to UDP
3
–How to compile non ansi C features with –ansi flag without warning. Some system features do not belong to ansi C. Compiling with –ansi flag may cause warnings or errors. Removing the warnings and errors requires some flags to be set. See lect6/example3.c –How to find the libraries needed to compile a program. The nm command See lect10/example1.c
4
Preforked server: –Main limitation with the concurrent server: fork overhead. Prefork N processes and use them forever. –See example1.c and example2.c –Comparison to other server implementation techniques: Single CPU, multiple CPU’s.
5
TCP: –Reliable byte stream service. –Different ways to build clients and servers What are the major problems when building clients/servers with TCP? –How to get around blocking I/O –Data format conversion –Assumption: whatever sent will eventually be received!! UDP: –Unreliable datagram service. Data may get lost – application may need to deal with more details in the communication.
6
Why UDP: –Applications that do not need 100% reliability communication. E.g VoIP, video stream, DNS servers. –Applications care a lot about performance: high performance computing (TCP cares too much about fairness). –Applications that need multicast or broadcast (TCP only supports point to point communication).
7
Basic UDP service interface: –Socket, bind, sendto, recvfrom, close UDP server UDP client socket bind sendto recvfrom sendto close TCP server TCP client socket Bind connect Listen Accept read/write close Read/write close
8
#include ssize_t recvfrom(int sockfd, void *buff, size_t nbytes, int flags, struct sockaddr *from, socklen_t *addrlen); ssize_t sendto(int sockfd, void *buff, size_t nbytes, int flags, const struct sockaddr *to, socklen_t addrlen); See example3.c/example4.c for communication using UDP. Show lost of packets in UDP? What is the error rate? Why?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.