IRIX® Network Programming Guide

IRIX® Network Programming Guide

IRIX® Network Programming Guide 007-0810-110 CONTRIBUTORS Written by Susan Thomas, Jed Hartman, and Judith Radin Updated by Helen Vanderberg, Terry Schultz, Julie Boney, and Steven Levine Production by Glen Traefald COPYRIGHT © 1999, 2003 Silicon Graphics, Inc. All rights reserved; provided portions may be copyright in third parties, as indicated elsewhere herein. No permission is granted to copy, distribute, or create derivative works from the contents of this electronic documentation in any manner, in whole or in part, without the prior written permission of Silicon Graphics, Inc. LIMITED RIGHTS LEGEND The electronic (software) version of this document was developed at private expense; if acquired under an agreement with the USA government or any contractor thereto, it is acquired as "commercial computer software" subject to the provisions of its applicable license agreement, as specified in (a) 48 CFR 12.212 of the FAR; or, if acquired for Department of Defense units, (b) 48 CFR 227-7202 of the DoD FAR Supplement; or sections succeeding thereto. Contractor/manufacturer is Silicon Graphics, Inc., 1600 Amphitheatre Pkwy 2E, Mountain View, CA 94043-1351. TRADEMARKS AND ATTRIBUTIONS Silicon Graphics, SGI, the SGI logo, and IRIX are registered trademarks and BDSPro and Indigo Magic are trademarks of Silicon Graphics, Inc., in the United States and/or other countries worldwide. IBM is a registered trademark of International Business Machines Corporation. MIPS is a registered trademark of MIPS Technologies, Inc., used under license by Silicon Graphics, Inc., in the United States and/or other countries worldwide. Sun is a registered trademark or trademark of Sun Microsystems, Inc. UNIX is a registered trademark of the Open Group in the United States and other countries. VAX is a trademark of Digital Equipment Corporation. Cover Design By Sarah Bolles, Sarah Bolles Design, and Dany Galgani, SGI Technical Publications Certain portions of these materials are derived from a document published as an Internet Request for Comment, S. Deering, Stanford University, 1989. This document uses material from chapters of the 4.3BSD Programmer’s Supplementary Documents and from various Internet Request For Comment documents. This product includes software developed by the University of California, Berkeley and its contributors. © Copyright 1982, 1986, 1990 Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. All advertising materials mentioning features or use of this software must display the following acknowledgment: This product includes software developed by the University of California, Berkeley and its contributors. 4. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. New Features in This Manual This update of the IRIX Network Programming Guide supports the 6.5.21 release of the IRIX operating system. Major Documentation Changes Chapter 2 includes a new section on the tcp_wrappers package. 007-0810-110 v Record of Revision Version Description 090 November 1999 Incorporates information for the IRIX 6.5.6 release 100 January 2003 Incorporates information for the IRIX 6.5.19 release 110 June 2003 Incorporates information for the IRIX 6.5.21 release 007-0810-110 vii Contents New Features in This Manual . v Record of Revision . vii Figures . xxi Tables . xxiii Examples . xxi About This Guide. xxiii Audience for This Guide . xxiv Typographic Conventions . xxiv Chapter Summaries . xxv Documentation Sources . xxvi Additional Reading . xxvii Obtaining Publications . xxvii Reader Comments . xxvii 1. Network Programming Overview . 1 Introduction to IRIX Network Programming . .2 The Internet Protocol Suite . 2 Compiling BSD and RPC Programs . 4 2. Sockets-based Communication . 7 Sockets Basics . 8 Socket Types . 9 Stream Sockets . 9 Datagram Sockets . 9 ST Sockets. 10 Raw Sockets . 10 007-0810-110 ix Contents Creating Sockets . 10 Binding Local Names to a Socket . 12 Establishing Socket Connections. 15 Transferring Data . 17 Discarding Sockets . 19 Scheduled Transfers Sockets . 20 Connectionless Sockets . 20 I/O Multiplexing . 21 Network Library Routines. 24 Host Names . 25 Network Names . 25 Protocol Names . 26 Service Names . 26 Network Dependencies . 27 Byte Ordering . 29 Translation Functions . 30 Node Names and Service Names . 30 Node Name Mapping . 33 Interface Identification . 34 The Client/Server Model . 34 Connection-based Servers . 35 Connection-based Clients. 38 Connectionless Servers . 39 Advanced Topics . 43 Out-of-Band Data . 43 Nonblocking Sockets . 45 Interrupt-driven Sockets I/O. 46 Signals and Process Groups . 47 Pseudo-Terminals . 48 Selecting Protocols. 50 Address Binding . 51 Socket Options . 54 x 007-0810-110 Contents The inetd Daemon . 55 The tcp_wrappers Package . 59 tcp_wrappers usage . 59 tcp_wrapper examples . 60 Broadcasting . 62 IP Multicasting . 66 Sending IP Multicast Datagrams . 68 Receiving IP Multicast Datagrams . 70 Sample Multicast Program . .72 3. Sockets-based Communication Using IPv6 . 75 Creation of an IPv6 Socket . 75 IPv6 Address Structures . 76 IPv6 Unspecified Address . 76 IPv6 Loopback Address . 77 Protocol Independent Socket Address Structure . 77 Server and Client Programs . 78 Connection-based Server and Client . .78 Connection-based Server . 78 Connection-based Client . 80 Connectionless Server and Client . 82 Connectionless Server . 82 Connectionless Client . 83 Socket Options . 85 Unicast Socket Options . 85 Multicast Socket Options. 85 Sending Packets . 85 Receiving Packets . 86 Socket Option for IPv6 Only. 87 Using Multicasting . 87 Sending IPv6 Multicast Datagrams . .87 Receiving IPv6 Multicast Datagrams . .88 007-0810-110 xi Contents 4. Introduction to RPC Programming . 89 Overview of Remote Procedure Calls . 90 The Remote Procedure Call Model . 90 RPC Transports and Semantics . 92 Binding and Rendezvous Independence . 93 RPC Message Identification and Authentication . 93 The XDR Standard . 94 The Layers of RPC . 95 The Highest Layer . 95 The Middle Layer . 95 The Lowest Layer . 96 The rpcgen Protocol Compiler . 96 Assigning RPC Program Numbers . 97 The Port Mapper Programs . 100 5. Programming with rpcgen . 101 Introduction to the rpcgen Compiler. 102 Changing Local Procedures to Remote Procedures . 103 Generating XDR Routines . 111 The C Preprocessor. 116 pcgen Programming Notes . 117 Generating ANSI C Prototypes . 117 Client-side Timeout Changes. 118 Server-side Broadcast Handling . 118 Other Information Passed to Server Procedures . 119 6. RPC Programming Guide . 123 The Layers of RPC . 124 The Highest Layer of RPC . 124 The Middle Layer of RPC. 125 Passing Arbitrary Data Types . 128 xii 007-0810-110 Contents The Lowest Layer of RPC . .131 More Information about the Server . .131 More Information about the Client. .134 Memory Allocation with XDR . .137 Other RPC Features . .138 Select on the Server Side . .138 Broadcast RPC. .139 Broadcast RPC Synopsis. ..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    370 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us