Preview

Network Programming with Sockets

Good Essays
Open Document
Open Document
9611 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Network Programming with Sockets
Beej 's Guide to Network Programming
Using Internet Sockets
Version 1.5.4 (17-May-1998)
[http://www.ecst.csuchico.edu/~beej/guide/net]
Intro
Hey! Socket programming got you down? Is this stuff just a little too difficult to figure out from the man pages? You want to do cool Internet programming, but you don 't have time to wade through a gob of structs trying to figure out if you have to call bind() before you connect(), etc., etc.
Well, guess what! I 've already done this nasty business, and I 'm dying to share the information with everyone! You 've come to the right place. This document should give the average competent C programmer the edge s/he needs to get a grip on this networking noise.
Audience
This document has been written as a tutorial, not a reference. It is probably at its best when read by individuals who are just starting out with socket programming and are looking for a foothold. It is certainly not the complete guide to sockets programming, by any means.
Hopefully, though, it 'll be just enough for those man pages to start making sense... :-)
Platform and Compiler
Most of the code contained within this document was compiled on a Linux PC using Gnu 's gcc compiler. It was also found to compile on HPUX using gcc. Note that every code snippet was not individually tested.
Contents:
What is a socket?
Two Types of Internet Sockets
Low level Nonsense and Network Theory structs--Know these, or aliens will destroy the planet!
Convert the Natives!
IP Addresses and How to Deal With Them socket()--Get the File Descriptor! bind()--What port am I on? connect()--Hey, you! listen()--Will somebody please call me?
1 of 26 12.03.99 01:21
Beej 's Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad...ramming; Using Internet Sockets/net.html 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!



References: Enough of this--back to coding! ;-) Copyright © 1995, 1996 by Brian "Beej" Hall

You May Also Find These Documents Helpful