Previous Topic: &SOCKET RECEIVE

Next Topic: &SOCKET REGISTER


&SOCKET RECEIVE_FROM

Receives data from a UDP socket specified by the socket ID.

&SOCKET RECEIVE_FROM
        ID=socket_id
      { MDO=mdo_name |
        VARS={ name | (name,name,... name) [SEGMENT] } |
        { ARGS | VARS=prefix* } [ RANGE=(start,end) ] [SEGMENT] }
      [ WAIT=time ]
      [ TYPE={ SYNC | ASYNC } ]

RECEIVE_FROM is used to receive data from a UDP socket.

Operands:

ID=socklet_id

(Mandatory) Specifies the identifier of the socket to be used for communication.

MDO=mdo_name

Specifies the name of the Mapped Data Object (MDO) into which information about the host is to be formatted.

VARS={ name | (name,name,... name) }

Specifies the names of the variables to be the target of the receive operation. If insufficient variables are provided, some data will not be available to the procedure. Excess variables are set to a null value.

SEGMENT

Specifies that there is no delimiter character but that the parsed string will be placed into the receiving variables in segments that correspond to the length of the individual variables. The length defaults to the maximum variable length unless overridden by length specifications in a variable list.

ARGS | VARS=prefix*

Specifies that the receive operation modifies or creates variables in a numeric range (&1 through &n for ARGS, prefix1 through prefixn for VARS) depending on how many are needed to satisfy the operation.

RANGE=(start,end)

The RANGE operand is coded to designate a start number and an end number to delimit the number of variables generated. The start and end values must be in the range 1 to 32767, and the end value must be equal to or greater than the start value.

WAIT=time

Specifies the period of time (in seconds) to wait for the receive to be completed. The default value is 0, meaning to wait until there is a successful receive.

TYPE={SYNC | ASYNC}

Indicates whether this is a synchronous (SYNC) or asynchronous (ASYNC) socket request. If TYPE=ASYNC is specified, WAIT cannot be specified. If TYPE=ASYNC is specified, the verb returns control immediately. If data is immediately available, return code 0 is set, and vars/MDO contain the data. If no data is immediately available, return code 12 is set, and a notification message is queued to the dependent environment when data is available:

N00101 NOTIFY: TCP/IP EVENT: RECEIVE_FROM RESOURCE: RC=rc RSN=rsn ERR=errno VERRIN=vendor_info ID=socket_id

After receiving this message, the procedure performs another RECEIVE_FROM with the same parameters to obtain the data.

Examples: &SOCKET RECEIVE_FROM

&SOCKET RECEIVE_FROM ID=&NSOCKID VARS=R* WAIT=300

Return Codes:

0

Receive_from successful

4

Receive_from timed out

8

Receive_from failed; see &ZFDBK for reason code, &ZSOCERRN and &ZSOCVERR for further error information.

12

Wait for notification of data availability

Notes:

The &SOCKET RECEIVE_FROM verb is executed only by applications that are using UDP sockets.

The information returned is set into the following NCL variables:

More information:

&SOCKET OPEN

&SOCKET SEND_TO

&DECODE