19
Programming Linux sockets, Part 2: Using UDP Writing UDP sockets applications in C and in Python Skill Level: Introductory David Mertz, Ph.D. ([email protected]) Developer Gnosis Software 25 Jan 2004 This intermediate-level tutorial extends the basics covered in Part 1 on programming using sockets. Part 2 focus es on the User Datagram Protocol (UDP) and demonstrates how to write UDP sockets applications in C and in Python. Although the code examples in this tutorial are in Python and C, they translate well to other languages. Section 1. Before you start About this tutorial IP sockets are the lowest-level layer upon which high-level Internet protocols are built: everything from HTTP to SSL to POP3 to Kerberos to UDP-Time. To implement custom protocols, or to customize implementation of well-known protocols, a programmer needs a working knowledge of the basic socket infras tructure. A simila r API is avail able in many languages; this tutorial uses C programming as a ubiquitous low-level language, and Python as a representative higher-level language for examples. In Part 1 of this tutori al series, David introduced readers to the basic s of programming custom network tools using the widespread and cross-platform Berkeley Sockets Interface. In this tutorial, he picks up with further explanation of User Datagram Protocol (UDP), and continues with a discussion of writing scalable socket servers. Using UDP  © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 1 of 19

Prog Linux Sockets 456

Embed Size (px)

Citation preview

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 1/19

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 2/19

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 3/19

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 5/19

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 6/19

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 7/19

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 8/19

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 9/19

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 10/19

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 11/19

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 12/19

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 13/19

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 14/19

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 15/19

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 16/19

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 17/19

8/14/2019 Prog Linux Sockets 456

http://slidepdf.com/reader/full/prog-linux-sockets-456 18/19