Compaq TCP/IP Services for OpenVMS
Sockets API and System Services Programming


Previous Contents Index


IO$_SETMODE|IO$M_READATTN

The IO$_SETMODE|IO$M_READATTN function/modifier combination requests that an Attention AST be delivered to the requesting process when a data packet is received on the socket and there is no waiting read request.

The Enable Read Attention AST function enables an Attention AST to be delivered to the requesting process only once. After the AST occurs, the function must explicitly reenable AST delivery before the AST can occur again. The function is subject to AST quotas.

Consider the following when using IO$M_READATTN:

If the TCPIP$C_OOBINLINE option is set, then a waiting READ $QIO is completed and the OOB character is returned in the data stream.


Arguments

p1


OpenVMS usage: ast_procedure
type: procedure value
access: call without stack unwinding
mechanism: by reference

To enable the AST, the p1 argument is the address of the Read Attention AST routine. To disable the AST, set p1 to 0.

p2


OpenVMS usage: user_arg
type: longword (unsigned)
access: read only
mechanism: by value

AST parameter to be delivered to the AST routine.

p3


OpenVMS usage: access_mode
type: longword (unsigned)
access: read only
mechanism: by value

Access mode to deliver the AST.

Condition Values Returned

SS$_ABORT Programming, INET management, or hardware error. The route entry already exists, so the attempt to add a route entry using the IO$_SETMODE function failed.
SS$_ACCVIO Programming error. An attempt to access an invalid memory location or buffer occurred.
SS$_BADPARAM Programming error. The parameter specified for a $QIO function was invalid for one of the following reasons:
  • An attempt to execute the IO$_SETMODE subfunctions without specifying a device socket occurred. Instead, create a device socket by issuing a $QIO with the IO$_SETMODE function and the proper parameters.
  • A socket option was specified incorrectly.
SS$_DEVACTIVE INET management error. An attempt to change the static INET parameter was unsuccessful. If you need new parameters, shut down the internet, reset the static parameters, and issue the START COMMUNICATION command.
SS$_DEVINTACT INET management error. The driver was not started. Issue a START COMMUNICATION command before issuing $QIO functions.
SS$_DEVNOTMOUNT INET management error. TCP/IP Services improperly executed the startup procedure. The driver was loaded, but the INET_ACP was not activated. Execute the INET startup procedure again.
SS$_DUPLNAM Programming error. An attempt to bind a port already in use occurred so the operation to bind the socket to the address and port failed.
SS$_EXQUOTA Programming or INET management error. The quota for the valid number of sockets caused an error for one of the following reasons:
  • An attempt to exceed the maximum number of sockets by creating new socket with the IO$_SETMODE function occurred. Increase the maximum number of allowable sockets (INET parameter) before creating more sockets.
  • The number of sockets specified with the IO$_SETMODE function exceeds the maximum number of sockets allowed. Increase the maximum number of sockets (INET parameter) or reduce the number of sockets that the listener socket can create ( listen parameter).
SS$_FILALRACC Programming error. An attempt to bind the socket to an address that is already in use occurred and the operation failed.
SS$_INSFMEM Programming or system management error. The system does not have enough resources to allocate new socket.
SS$_ILLCNTRFUNC Programming error. Operation is not supported.
  • Invalid IO$_SETMODE (IOCTL) function was used for the interface. The interface does not have an IOCTL routine.
  • An attempt was made to perform an IO$_SETMODE (IOCTL) function that required a socket, but the device did not have one. Create a socket and issue the IOCTL function.
SS$_IVADDR Programming error. The specified INET address is not in the system, and an invalid port number or an invalid INET address combination was specified with an IO$_SETMODE function (a bind).
  • An attempt to bind the address failed because the INET address is not in the system, port zero and INET address zero are not allowed, or port zero is not allowed when using an IO$_ACCESS or IO$_WRITEVBLK function.
  • An attempt to make a permanent entry in the ARP table failed because of lack of space. Too many permanent entries.
  • An attempt was made to bind an IP socket (raw IP) when there are no interfaces defined in the system.
  • An attempt was made to bind an IP socket (raw IP) to a null INET address.
SS$_IVBUFLEN Programming error. The socket option buffer has an invalid size.
SS$_NOLICENSE Programming or system management error. TCP/IP Services not present.
SS$_NOOPER Programming or INET management error. An attempt was made to execute an I/O function that needs the OPER privilege.
SS$_NOPRIV Programming or INET management error. Not enough privileges for the attempted operation.
  • Broadcasting an IP datagram was denied because the process does not have a system UIC or SYSPRV, BYPASS, or OPER privilege.
  • An attempt was made to use a reserved port number lower than 1024.
  • An operation accesses only processes that have a system UIC or SYSPRV, or BYPASS privilege.
  • Raw IP protocol can be used only on privileged sockets. The process must have a SYSPRV or BYPASS privilege.
SS$_NOSUCHDEV Programming error or INET management error. An INET address is not in the ARP table. An attempt to show or delete an ARP table entry failed.
SS$_NOSUCHNODE Programming error or INET management error. An attempt to delete a route from the routing table failed because a route entry was not found.
SS$_PROTOCOL Programming error.
  • The protocol type specified at socket creation is not valid.
  • The protocol is not supported.
  • The protocol type specified is not found in the internal tables. It is an invalid type.
  • The address family is not supported:
    • The address family specified with an IO$_SETMODE function (IOCTL subfunction) is not supported. The address family should be the TCPIP$C_AF_INET or TCPIP$C_UNSPEC address family.
    • The address family of the remote INET address specified with an IO$_ACCESS or IO$_WRITEVBLK function is not supported (UDP/IP or TCP/IP). The address family should be the TCPIP$C_AF_INET address family.
    • The address family of the local INET address specified with an IO$_SETMODE (bind) function is not supported. The address family should be the TCPIP$C_AF_INET address family.
    • The address family of the INET address that is specified in a request to the routing module is not supported. The address family should be the TCPIP$C_AF_INET address family.
SS$_SHUT The local or remote node is no longer accepting connections.

IO$_SETMODE|IO$M_WRTATTN

The IO$_SETMODE|IO$M_WRTATTN function/modifier combination (IO$M_WRTATTN is Enable Write Attention AST) requests that an Attention AST be delivered to the requesting process when a data packet can be queued to the socket. For TCP sockets, this occurs when space becomes available in the TCP transmit queue.

The Enable Write Attention AST function enables an Attention AST to be delivered to the requesting process only once. After the AST occurs, the function must explicitly reenable AST delivery before the AST can occur again. The function is subject to AST quotas.

There is a one-to-one correspondence between the number of times you enable an Attention AST and the number of times the AST is delivered. For example, for each enabled AST, one AST is delivered. If you enable an Attention AST several times, several ASTs are delivered for one event when the event occurs.

You can use the management command SHOW DEVICE_SOCKET to display information about the socket's characteristics, options, and state.


Arguments

p1


OpenVMS usage: ast_procedure
type: procedure value
access: call without stack unwinding
mechanism: by reference

To enable the AST, the p1 argument is the address of the Write Attention AST routine. To disable the AST, p1 is set to 0.

p2


OpenVMS usage: user_arg
type: longword (unsigned)
access: read only
mechanism: by value

AST parameter to be delivered to the AST routine.

p3


OpenVMS usage: access_mode
type: longword (unsigned)
access: read only
mechanism: by value

Access mode to deliver the AST.

Condition Values Returned

SS$_ABORT Programming error, INET management error, or hardware error. The route specified with the IO$_SETMODE function already exists. Therefore, the operation failed.
SS$_ACCVIO Programming error. An attempt to access an invalid memory location or buffer occurred.
SS$_BADPARAM Programming error. The parameter specified for the $QIO I/O function was invalid for one of the following reasons:
  • An attempt to execute the IO$_SETMODE functions without specifying a device socket occurred. Instead, create a device socket by issuing a $QIO with the IO$_SETMODE function and the proper parameters.
  • A socket option was specified incorrectly.
SS$_DEVACTIVE INET management error. You attempted to change the static INET parameters. If you need new parameters, shut down the internet, reset the static parameters, and issue the START COMMUNICATION command.
SS$_DEVINTACT INET management error. The driver is not started. Issue a START COMMUNICATION command before issuing $QIO functions.
SS$_DEVNOTMOUNT INET management error. The INET startup procedure was improperly executed. The driver was loaded, but the INET_ACP was not activated. Execute the INET startup procedure again.
SS$_DUPLNAM Programming error. Port that is being bound is already in use. An attempt to bind the socket to an address and port failed.
SS$_EXQUOTA Programming or INET management error.
  • An attempt to create a new socket with the IO$_SETMODE function and it failed because the maximum number of sockets was exceeded. Increase the maximum number of sockets (INET parameter), and then create a new socket.
  • The number of sockets specified with the IO$_SETMODE function exceeds the allowable maximum number of sockets. Increase the maximum number of sockets (INET parameter), or reduce the number of sockets that the listener socket can create ( listen parameter).
SS$_FILALRACC Programming error. Because the INET address is already in use, an attempt to bind the socket to an address and port failed.
SS$_INSFMEM Programming or system management error. There are not enough resources to allocate a new socket.
SS$_ILLCNTRFUNC Programming error. The operation is unsupported for one of the following reasons:
  • An invalid IO$_SETMODE function for the interface was specified. The interface does not have an IOCTL routine.
  • An attempt to execute an IO$_SETMODE function that required a socket, but the device did not have one. Instead, create a socket and issue the function.
SS$_IVADDR Programming error. An invalid port number and INET address combination was specified with the IO$_SETMODE bind function. This caused the operation to fail for one of the following reasons:
  • An illegal combination of port zero and INET address zero was specified.
  • An attempt to make a permanent entry in the ARP table occurred, and the operation failed because of lack of space. There are too many permanent entries.
  • An attempt to bind a raw IP socket occurred when there were no interfaces defined in the system.
  • An attempt to bind a raw IP socket to a null INET address occurred.
SS$_IVBUFLEN Programming error. An invalid size was specified for the socket option buffer.
SS$_NOLICENSE Programming or system management error. There is no TCP/IP Services license present.
SS$_NOOPER Programming or INET management error. An attempt to execute an I/O function that needs the OPER privilege occurred.
SS$_NOPRIV Programming or INET management error. The operation failed for one of the following reasons:
  • An attempt to broadcast an IP datagram for a process without having a system UIC or SYSPRV, BYPASS, or OPER privilege.
  • An attempt to use a reserved port number lower than 1024 occurred.
  • An attempt to access a process without having a system UIC or SYSPRV, or BYPASS privilege occurred.
  • An attempt to use raw IP on a socket that is not a privileged socket occurred. To do this, the process must have SYSPRV or BYPASS privilege.
SS$_NOSUCHDEV Programming error or INET management error. An attempt to show or delete an entry in the ARP table occurred. However, because the INET address was not in the ARP table, the operation failed.
SS$_NOSUCHNODE Programming error or INET management error. An attempt to delete a route from the routing information table (RIT) occurred. However, because the route was not found in the RIT, the operation failed.
SS$_PROTOCOL Programming error.
  • An invalid protocol type was specified when creating a socket.
  • An unsupported protocol was specified.
  • An unsupported protocol type was specified because it is not found in the internal tables.
  • An unsupported address family was specified for one of the following reasons:
    • An invalid address family was specified with an IO$_SETMODE subfunction. Instead, specify the TCPIP$C_AF_INET or TCPIP$C_UNSPEC address family.
    • An address family of the remote INET address for a datagram or stream socket was specified with an IO$_ACCESS or IO$_WRITEVBLK function. Instead, specify the TCPIP$C_AF_INET address family.
    • An invalid address family of the local INET address was specified with an IO$_SETMODE bind function. Instead, specify the TCPIP$C_AF_INET address family.
    • You made a request to the routing module by specifying the address family of the INET address. Instead, specify the TCPIP$C_AF_INET address family.
SS$_SHUT The local or remote node is no longer accepting connections.

IO$_WRITEVBLK

The IO$_WRITEVBLK function transmits data from the specified user buffers to an internet host. Use both p1 and p2 arguments to specify a single user buffer. Use the p5 argument to specify multiple buffers.

For connection-oriented protocols, such as TCP, if the socket transmit buffer is full, the IO$_WRITEVBLK function is blocked until the socket transmit buffer has room for the user data.

For connectless-oriented protocols, such as UDP and raw IP, the user data is transmitted in one datagram. If the user data is greater than the socket's transmit quota, the error code (SS$_TOOMUCHDATA) is returned.

Related Functions

The equivalent Sockets API functions are send() , sendto() , sendmsg() , and write() .


Arguments

p1


OpenVMS usage: buffer
type: vector byte (unsigned)
access: read only
mechanism: by 32- or 64-bit reference (Alpha)

The 32- or 64-bit address (on Alpha systems) or the 32-bit address (on VAX systems) of the buffer containing the data to be transmitted. The length of this buffer is specified by the p2 argument.

p2


OpenVMS usage: buffer_length
type: quadword unsigned (Alpha); longword unsigned (VAX)
access: read only
mechanism: by 64-bit value (Alpha)

The length (in bytes) of the buffer containing data to be transmitted. The address of this buffer is specified by the p1 argument.

p3


OpenVMS usage: socket_name
type: vector byte (unsigned)
access: read only
mechanism: by item_list_2 descriptor

The remote port number and internet address of the message destination. The p3 argument is the address of an item_list_2 descriptor pointing to the socket address structure containing the remote port number and internet address.

p4


OpenVMS usage: mask_longword
type: longword (unsigned)
access: read only
mechanism: by value

Longword of flags to specify attributes for this write operation. The following table lists the available write flags:
Write Flag Description
TCPIP$C_MSG_OOB Writes an out-of-band (OOB) byte.
TCPIP$C_MSG_DONTROUTE Sends message directly without routing.
TCPIP$C_MSG_NBIO Completes the I/O operation and returns an error if a condition arises that would cause the I/O operation to be blocked. (Similar to using IO$M_NOWAIT.)

p5


OpenVMS usage: buffer_list
type: vector byte (unsigned)
access: read only
mechanism: by 32- or 64-bit descriptor-fixed-length descriptor (Alpha)

Input buffer list describing one or more buffers containing the data to be transmitted. The p5 argument is the 32- or 64-bit address (on Alpha systems) or the 32-bit address (on VAX systems) of a descriptor pointing to a input buffer list. Buffers are transmitted in the order specified by the input buffer list. The transfer-length value returned in the I/O status block is the total number of bytes transferred from all buffers.

If you use the p1 and p2 arguments, do not use the p5 argument; they are mutually exclusive.


Function Modifiers

IO$M_EXTEND Allows the use of extended modifiers with BSD Version 4.4. Valid only for datagram sockets (UDP or raw IP); ignored for TCP.
IO$M_INTERRUPT Sends an OOB message.
IO$M_NOWAIT Regardless of a $QIO or $QIOW, if the system detects a condition that would cause the operation to block, the system completes the I/O operation and returns the SS$_SUSPENDED status code.

When using this function modified, always check the message length in the IOSB to ensure that all data is transferred. IO$_WRITEVBLK returns a success status even if data is only partially transferred.


Condition Values Returned

SS$_ABORT Programming error, INET management error, or hardware error. The execution of the I/O was aborted.
SS$_ACCVIO Programming error. An attempt was made to access an invalid memory location or buffer.
SS$_BADPARAM Programming error. A $QIO I/O function was specified using an invalid parameter.
  • An attempt was made to execute an IO$_WRITEVBLK function without specifying a device socket. First create a device socket by issuing an IO$_SETMODE function and the proper arguments.
  • An attempt was made to issue an IO$_WRITEVBLK function that did not specify a correct buffer address ( p1 or p5 is null).
  • An attempt was made to issue an IO$_WRITEVBLK that specifies an invalid vectored buffer ( p5 specifies an invalid address descriptor).
SS$_CANCEL The I/O operation was canceled by the $CANCEL system service.
SS$_DEVINTACT The network driver was not started.
SS$_DEVNOTMOUNT The network driver is loaded, but the INETACP in not currently available for use.
SS$_EXQUOTA Returned when process resource mode wait is disabled. There is no internet request packet (IRP) available for completing the request. Increase the buffered I/O quota.
SS$_FILALRACC Programming error.
  • INET address is already in use. An attempt was made to bind the socket to an address but the port failed.
  • IP protocol (raw socket). An attempt was made to specify a remote INET socket address with an IO$_WRITEVBLK function, while an INET address was already specified with an IO$_ACCESS function.
  • UDP/IP protocol. An attempt was made to specify a remote INET socket address with an IO$_WRITEVBLK function, while an INET address was already specified with the IO$_ACCESS function.
SS$_ILLCNTRFUNC Programming error. Unsupported operation on the protocol (IP, UDP/IP, TCP/IP).
SS$_INSFMEM INET management or programming error returned when process resource mode wait is disabled. Not enough system space for buffering user data. A higher quota for socket buffer space needs to be set, or the internet needs more dynamic buffer space (number of dynamic clusters should be increased).
SS$_IVADDR Programming error. The specified INET address is not in the system, and an invalid port number or an INET address combination was specified with an IO$_WRITEVBLK operation.
  • An attempt to bind the socket failed because the INET address is not in the system, port number zero and INET address zero are not allowed, or port zero is not allowed with an IO$_ACCESS or IO$_WRITEVBLK function.
  • An attempt to get an interface INET address, broadcast mask, or network mask failed.
  • A send request was made on a datagram-oriented protocol, but the destination address is unknown or not specified.
SS$_IVBUFLEN Programming error.
  • The size of the buffer for an I/O function is insufficient.
  • An attempt was made to issue an IO$_WRITEVBLK function that specifies a correct buffer address ( p1 valid) but does not specify a buffer length ( p2 is null).
SS$_LINKDISCON Notification. Connection completion return code. The virtual circuit (TCP/IP) was closed at the initiative of the peer. The application must stop sending data and must either shut down or close the socket.
SS$_PROTOCOL Programming error. The address family of the remote INET address specified with an IO$_WRITEVBLK function is not supported (UDP/IP or TCP/IP). The address family should be the TCPIP$C_AF_INET address family.
SS$_NOLINKS Programming error. The socket was not connected (TCP/IP), or an INET port and address were not specified with an IO$_ACCESS (UDP/IP or IP).
  • An IO$_WRITEVBLK with no remote INET socket address was issued on a socket that was not the object of an IO$_ACCESS function (raw IP).
  • An IO$_WRITEVBLK with no remote INET socket address was issued on a socket that was not the object of an IO$_ACCESS function (UDP/IP).
  • An attempt was made to disconnect a socket that is not connected, or an attempt was made to issue an IO$_WRITEVBLK function on an unconnected socket (TCP/IP).
SS$_SHUT The local or remote node is no longer accepting connections.
SS$_SUSPENDED The system detected a condition that might cause the operation to block.
SS$_TIMEOUT Programming error, INET management error, or hardware error.
  • A TCP/IP connection timed out after several unsuccessful retransmissions.
  • On a TCP socket where KEEPALIVE is set, the connection was idle for longer than the timeout interval (The default is 10 minutes).
SS$_TOOMUCHDATA Programming or INET management error. The message size was too large.
  • An IP packet that is broadcast cannot be fragmented.
  • The Not Fragment IP flag was set and the IP datagram was too large to be sent without being fragmented.
  • Internal error. The length of the Ethernet datagram does not allow enough space for the minimum IP header.
  • The message to be sent on a UDP/IP or raw IP socket is larger than the socket buffer high water allows.
  • An attempt was made to send or receive more than 16 buffers specified with the p5 argument.
SS$_UNREACHABLE Communication status. The remote host is currently unreachable.

Hardware error. The data link adapter detected an error and shut itself off. The TCP/IP Services software is waiting for the adapter to come back on line.


Previous Next Contents Index