DIGITAL TCP/IP Services for OpenVMS
System Services and C Socket Programming
Begin
Contents (summary)
Chapter 1
Sockets Programming Interfaces
Chapter 2
Writing Internet Applications
Chapter 3
Using the OpenVMS System Services
Chapter 4
OpenVMS System Services Reference
Chapter 5
Using DEC C Socket Routines
Chapter 6
DEC C Socket Routine Reference
Chapter 7
Error Codes
Appendix A
Online Program Examples
Index
Figures
Examples
Tables
Contents
Chapter 1
Sockets Programming Interfaces
1.1
OpenVMS System Services
1.2
C Socket Interface
1.3
Location of Application Development Files
Chapter 2
Writing Internet Applications
2.1
The Client/Server Communication Process
2.2
Creating a Device Socket
2.2.1
Creating Device Sockets with OpenVMS System Services
2.2.2
Creating Device Sockets with the C Socket Interface
2.3
Using the Berkeley Internet Name Domain Service
2.3.1
BIND Lookups with OpenVMS System Services
2.3.2
BIND Lookups with the C Socket Interface
2.4
Binding a Socket
2.4.1
Binding Sockets with OpenVMS System Services
2.4.2
Binding Sockets with the C Socket Interface
2.5
Making a Socket a Listener (TCP Server)
2.5.1
Listening to a Socket with OpenVMS System Services
2.5.2
Listening to a Socket with a C Socket Interface
2.6
Initiating a Connection with a TCP Client
2.6.1
Initiating a Connection with OpenVMS System Services
2.6.2
Initiating a Connection with a C Socket Interface
2.7
Accepting a Connection with a TCP Server
2.7.1
Accepting a Connection Using OpenVMS System Services
2.7.2
Accepting a Connection Using a C Socket Interface
2.8
Obtaining Device Socket Information
2.8.1
Getting Device Socket Information with OpenVMS System Services
2.8.2
Getting Device Socket Information with a C Socket Interface
2.9
Reading Data
2.9.1
Reading Data with OpenVMS System Services
2.9.2
Reading Data with a C Socket Interface
2.10
Reading Out-of-Band Data (TCP)
2.10.1
Reading OOB Data with OpenVMS System Services
2.10.2
Reading OOB Data with a C Socket Interface
2.11
Peeking at Queued Messages
2.11.1
Peeking at Data with OpenVMS System Services
2.11.2
Peeking at Data with a C Socket Interface
2.12
Writing Data
2.12.1
Writing Data with OpenVMS System Services
2.12.2
Writing Data with a C Socket Interface
2.13
Writing OOB Data (TCP)
2.13.1
Writing OOB Data with OpenVMS System Services
2.13.2
Writing OOB Data with a C Socket Interface
2.14
Writing Data and Broadcast Messages (UDP)
2.15
Sending a Datagram (UDP)
2.15.1
Sending Datagrams with OpenVMS System Services
2.15.2
Broadcasting Datagrams with OpenVMS System Services
2.15.3
Broadcasting Datagrams with a C Socket Interface
2.16
Closing and Deleting a Socket
2.16.1
Closing and Deleting with OpenVMS System Services
2.16.2
Closing and Deleting with a C Socket Interface
2.17
Shutting Down Sockets
2.17.1
Shutting Down a Socket with OpenVMS System Services
2.17.2
Shutting Down with a C Socket Interface
2.18
Canceling I/O Operations
2.19
Application Development Tools for OpenVMS System Services Programming
2.19.1
Include Files for OpenVMS System Services Programming
2.19.2
Data Structures for OpenVMS System Services Programming
2.19.3
Support Routines for OpenVMS System Services Programming
2.20
Compiling and Linking DIGITAL C Language Programs
2.20.1
Linking Programs Compiled by DEC C
2.20.2
Linking Programs Compiled by VAX C
Chapter 3
Using the OpenVMS System Services
3.1
$QIO System Service Variations
3.2
$QIO Syntax
3.2.1
$QIO Function-Dependent Parameters
3.3
Common $QIO Functions
3.4
$QIO Arguments
3.4.1
Device- and Function-Independent $QIO Arguments
3.4.2
Function-Dependent $QIO Arguments
3.5
Item Lists and Item List Descriptors
3.6
Specifying an Input Parameter List
3.7
Specifying an Output Parameter List
3.8
Specifying the Socket Name
3.9
Specifying Socket Options, Protocol Options, and I/O Control Parameters
Chapter 4
OpenVMS System Services Reference
4.1
System Service Descriptions
Command 1
$ASSIGN
Command 2
$CANCEL
Command 3
$DASSGN
Command 4
$GETDVI
Command 5
$QIO
4.2
Internet I/O Function Codes
Command 6
IO$_ACCESS
Command 7
IO$_ACPCONTROL
Command 8
IO$_DEACCESS
Command 9
IO$_READVBLK
Command 10
IO$_SENSEMODE/IO$_SENSECHAR
Command 11
IO$_SETMODE/IO$_SETCHAR
Command 12
IO$_SETMODE|IO$M_OUTBAND
Command 13
IO$_SETMODE|IO$M_READATTN
Command 14
IO$_SETMODE|IO$M_WRTATTN
Command 15
IO$_WRITEVBLK
Chapter 5
Using DEC C Socket Routines
5.1
Internet Protocols
5.1.1
TCP Sockets
5.1.1.1
Wildcard Addressing
5.1.2
UDP Sockets
5.2
Calling a C Socket Routine from an AST State
5.3
Calling From KERNEL or EXEC Modes
5.4
Standard I/O
5.5
Event Flags
5.6
Suppressing DEC C Compilation Warnings
5.7
Header Files
5.8
DEC C Structures
5.8.1
hostent Structure
5.8.2
in_addr Structure
5.8.3
iovec Structure
5.8.4
linger Structure
5.8.5
msghdr Structure
5.8.6
netent Structure
5.8.7
sockaddr Structure
5.8.8
sockaddr_in Structure
5.8.9
timeval Structure
5.9
errno Values
Chapter 6
DEC C Socket Routine Reference
6.1
Basic Communication Routines
Command 16
accept()
Command 17
bind()
Command 18
close()
Command 19
connect()
Command 20
listen()
Command 21
read()
Command 22
recv()
Command 23
recvfrom()
Command 24
recvmsg()
Command 25
select()
Command 26
send()
Command 27
sendmsg()
Command 28
sendto()
Command 29
shutdown()
Command 30
socket()
Command 31
write()
6.2
Communication Support Routines
Command 32
decc$get_sdc()
Command 33
gethostbyaddr()
Command 34
gethostbyname()
Command 35
gethostname()
Command 36
getnetbyaddr()
Command 37
getnetbyname()
Command 38
getnetent()
Command 39
getpeername()
Command 40
getprotobyname()
Command 41
getprotobynumber()
Command 42
getprotoent()
Command 43
getservbyname()
Command 44
getservbyport()
Command 45
getsockname()
Command 46
getsockopt()
Command 47
htonl()
Command 48
htons()
Command 49
inet_addr()
Command 50
inet_lnaof()
Command 51
inet_makeaddr()
Command 52
inet_netof()
Command 53
inet_network()
Command 54
inet_ntoa()
Command 55
ntohl()
Command 56
ntohs()
Command 57
setsockopt()
Command 58
vaxc$get_sdc()
Chapter 7
Error Codes
Appendix A
Online Program Examples
A.1
TCP/IP Server Using QIO Calls
A.2
UDP/IP Server --- C Socket Example
A.3
TCP/IP Server --- C Socket Example
A.4
TCP/IP Server Accepting a Connection from the Auxiliary Server
A.5
TCP/IP Client Using the IPC Socket Interface
Index
Examples
2-1
Creating a Device Socket Using OpenVMS System Services
2-2
Binding a Socket Using C Socket Programming
2-3
BIND Lookup Using OpenVMS System Services
2-4
BIND Lookup Using C Socket Programming
2-5
Binding Socket Using OpenVMS System Services
2-6
Binding a Socket Using C Socket Programming
2-7
Setting the Socket to Listen Using OpenVMS System Services
2-8
Setting the Socket to Listen Using C Socket Programming
2-9
Initiating a Connection Using OpenVMS System Services
2-10
Initiating a Connection Using C Socket Programming
2-11
Accepting an Incoming Connection Request Using OpenVMS System Services
2-12
Accepting a Connection Request Using C Socket Programming
2-13
Obtaining Device Socket Information by Using OpenVMS System Services
2-14
Obtaining Device Socket Information by Using C Socket Programming
2-15
Reading Data Using OpenVMS System Services
2-16
Reading Data Using C Socket Programming
2-17
Reading OOB Data Using OpenVMS System Services
2-18
Reading OOB Data Using C Socket Programming
2-19
Previewing Data Using C Socket Programming
2-20
Writing Data Using OpenVMS System Services
2-21
Writing Data Using C Socket Programming
2-22
Writing OOB Data Using OpenVMS System Services
2-23
Writing OOB Data Using C Socket Programming
2-24
Closing and Deleting a Socket Using OpenVMS System Services
2-25
Closing and Deleting a Socket Using C Socket Programming
2-26
Shutting Down a Socket Using OpenVMS System Services
2-27
Shutting Down a Socket Using C Socket Programming
3-1
Specifying IOCTL Parameters
4-1
$ASSIGN System Service (MACRO-32)
4-2
$ASSIGN System Service (C Programming)
4-3
$CANCEL System Service (MACRO-32)
4-4
$CANCEL System Service (C Programming)
4-5
$DASSGN System Service (MACRO-32)
4-6
$DASSGN System Service (C Programming)
4-7
IO$_ACPCONTROL Function (MACRO-32 Programming)
4-8
IO$_ACPCONTROL Function (C Programming)
4-9
IO$_READVBLK Function (MACRO-32 Programming)
4-10
IO$_READVBLK Function --- Vectored Buffers (C Programming)
4-11
IO$_READVBLK Function --- INET device (C Programming)
4-12
IO$_WRITEVBLK Function (MACRO-32 Programming)
4-13
IO$_WRITEVBLK Function --- Vectored (C Programming)
4-14
IO$_WRITEVBLK Function (C Programming)
A-1
TCP/IP Server Using QIO Calls
A-2
UDP/IP Server Using the C Socket Interface
A-3
TCP/IP Server Using the C Socket Interface
A-4
TCP/IP Server Accepting a Connection from the Auxiliary Server
A-5
TCP/IP Client Using the IPC Socket Interface
Figures
2-1
TCP Socket Communication Process
2-2
UDP Socket Communication Process
3-1
I/O Status Block
3-2
Specifying an Input Parameter List
3-3
Specifying an Output Parameter List
3-4
Specifying the Local or Remote Socket Name
3-5
Specifying Socket Options
3-6
Specifying IOCTL Functions
3-7
Specifying Socket Options
3-8
Specifying IOCTL Parameters
4-1
Single Item Descriptor
Tables
1-1
Internet Definition Files --- SYS$LIBRARY:
1-2
C Socket Routine Libraries --- SYS$LIBRARY:
1-3
UDP Programming Examples --- UCX$EXAMPLES:
1-4
TCP Programming Examples --- UCX$EXAMPLES:
2-1
TCP Server Calling Sequence and Related Routines
2-2
TCP Client Calling Sequence and Related Routines
2-3
UDP Server Calling Sequence and Related Routines
2-4
UDP Client Calling Sequence and Related Routines
2-5
OpenVMS System Service Include Files
3-1
$QIO Arguments
3-2
Internet Symbol Definition Files
3-3
$QIO Functions
3-4
Device- and Function-Independent Arguments
3-5
I/O Status Block Fields
3-6
Function-Dependent$QIO Arguments
3-7
p5
Descriptor Fields
3-8
p6
Descriptor Fields
3-9
sockaddr_in Fields
4-1
OpenVMS System Service and Equivalent C Socket Call
4-2
$GETDVI Item Code Descriptions
4-3
Symbolic Names for$GETDVI
4-4
Device Unit Status Symbolic Names
4-5
Internet I/O Function Codes
4-6
Valid INET Subfunction Codes
4-7
INET Call Codes
4-8
Valid Flags for the
p4
Argument
4-9
The
p6
Socket Options
4-10
TCP/IP Options
4-11
IP Options
4-12
IOCTL Commands
4-13
Valid Protocols for IO$_SETMODE and IO$_SETCHAR
4-14
Valid Socket Types for IO$_SETMODE and IO$_SETCHAR
4-15
Communications Socket Options
4-16
TCP Options
4-17
IP Options
4-18
Valid Write Flags for the
p4
Argument
5-1
TCP Socket Type Descriptions
5-2
errno Values
6-1
Basic Communication Routines
6-2
Communication Support Routines
6-3
Communications Socket Options
6-4
TCP/IP Options
6-5
IP Options
7-1
Translation of Socket Error Codes to OpenVMS Error Codes
A-1
Location of Online Program Examples --- UCX$EXAMPLES:
Next