Beej's Guide to Network Programming
Free

Beej's Guide to Network Programming

By Brian "Beej Jorgensen." Hall
Free
Book Description

Beej's Guide to Network Programming has been one of the top socket programming guides on the Internet for the last 15 years. The Guide is designed to irreverently ease your first steps into Internet Sockets programming in C. Starting from the ground up, it provides complete examples of simple clients and servers supporting both IPv6 and IPv4.



Once you get through the tutorial section of the book, Part Two contains a handy-dandy reference section which helps prevent the book from becoming simple dead weight on your shelf once you've devoured it.



The book focuses on the C programming language in Unix-like environments, but Windows users can still glean relevant information from its pages. Also, once you understand socket programming in C, you'll much more easily understand it in many other languages as well.

Table of Contents
  • Contents
  • Intro
    • Audience
    • Platform and Compiler
    • Official Homepage and Books For Sale
    • Note for Solaris/SunOS Programmers
    • Note for Windows Programmers
    • Email Policy
    • Mirroring
    • Note for Translators
    • Copyright and Distribution
  • What is a socket?
    • Two Types of Internet Sockets
    • Low level Nonsense and Network Theory
  • IP Addresses, structs, and Data Munging
    • IP Addresses, versions 4 and 6
      • Subnets
      • Port Numbers
    • Byte Order
    • structs
    • IP Addresses, Part Deux
      • Private (Or Disconnected) Networks
  • Jumping from IPv4 to IPv6
  • System Calls or Bust
    • getaddrinfo()—Prepare to launch!
    • socket()—Get the File Descriptor!
    • bind()—What port am I on?
    • connect()—Hey, you!
    • listen()—Will somebody please call me?
    • accept()—"Thank you for calling port 3490."
    • send() and recv()—Talk to me, baby!
    • sendto() and recvfrom()—Talk to me, DGRAM-style
    • close() and shutdown()—Get outta my face!
    • getpeername()—Who are you?
    • gethostname()—Who am I?
  • Client-Server Background
    • A Simple Stream Server
    • A Simple Stream Client
    • Datagram Sockets
  • Slightly Advanced Techniques
    • Blocking
    • select()—Synchronous I/O Multiplexing
    • Handling Partial send()s
    • Serialization—How to Pack Data
    • Son of Data Encapsulation
    • Broadcast Packets—Hello, World!
  • Common Questions
  • Man Pages
    • accept()
    • bind()
    • connect()
    • close()
    • getaddrinfo(), freeaddrinfo(), gai_strerror()
    • gethostname()
    • gethostbyname(), gethostbyaddr()
    • getnameinfo()
    • getpeername()
    • errno
    • fcntl()
    • htons(), htonl(), ntohs(), ntohl()
    • inet_ntoa(), inet_aton(), inet_addr
    • inet_ntop(), inet_pton()
    • listen()
    • perror(), strerror()
    • poll()
    • recv(), recvfrom()
    • select()
    • setsockopt(), getsockopt()
    • send(), sendto()
    • shutdown()
    • socket()
    • struct sockaddr and pals
  • More References
    • Books
    • Web References
    • RFCs
  • Index
    You May Also Like
    Also Available On
    Categories
    Curated Lists