I-Sockets - A A PPENDIX PPENDIX I I S S OCKETS OCKETS : : A...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: A A PPENDIX PPENDIX I I S S OCKETS OCKETS : : A P A P ROGRAMMER ROGRAMMER ' ' S S I I NTRODUCTION NTRODUCTION William Stallings Copyright 2008 C.1 SOCKETS, SOCKET DESCRIPTORS, PORTS, AND CONNECTIONS......................3 C.2 THE CLIENT/SERVER MODEL OF COMMUNICATION..........................................4 Running a Sockets Program on a Windows Machine Not Connected to a Network.....5 Running a Sockets Program on a Windows Machine Connected to a Network, When Both Server and Client Reside on the Same Machine...................................................5 C.3 SOCKETS ELEMENTS...................................................................................................5 Socket Creation..............................................................................................................5 The Socket Address .......................................................................................................6 Bind to a local port.........................................................................................................6 Data representation and byte ordering..........................................................................7 Connecting a socket.......................................................................................................8 The gethostbyname() function call.....................................................................10 Listening for an incoming client connection................................................................13 Accepting a connection from a client ..........................................................................13 Sending and Receiving messages on a socket .............................................................15 Closing a socket...........................................................................................................16 Report errors ......................................................................................................16 Example TCP/IP Client Program (Initiating Connection)...........................................18 Example TCP/IP server program (passively awaiting connection).............................19 C.4 STREAM AND DATAGRAM SOCKETS....................................................................22 Example UDP Client Program (Initiate Connections).................................................22 Example UDP Server Program (Passively Await Connection)...................................24 C.5 RUN-TIME PROGRAM CONTROL..............................................................................25 Nonblocking socket calls.............................................................................................25 Asynchronous I/O (Signal Driven I/O)........................................................................27 C.6 REMOTE EXECUTION OF A WINDOWS CONSOLE APPLICATION..................30 Local code....................................................................................................................30Local code....
View Full Document

This note was uploaded on 09/13/2008 for the course CSCI 4020u taught by Professor Jimcar during the Spring '08 term at Trinity University.

Page1 / 39

I-Sockets - A A PPENDIX PPENDIX I I S S OCKETS OCKETS : : A...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online