Previous Topic: &SNAMS SEND

Next Topic: &SOCKET CLOSE


&SOCKET ACCEPT

Services incoming connection requests.

&SOCKET ACCEPT ID=socket_id [TYPE={SYNC | ASYNC}]

ACCEPT is used by a server application to accept incoming connection requests from a client and create a new socket.

Operands:

ID=socklet_id

Specifies the identity of the socket created by &SOCKET REGISTER.

TYPE={SYNC | ASYNC}

Indicates whether this is a synchronous (SYNC) or asynchronous (ASYNC) socket request. If TYPE=ASYNC is specified, the verb returns control immediately, and a notification message is queued to the dependent environment when ACCEPT completes:

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

Note: ID= is omitted if the ACCEPT fails.

Examples: &SOCKET ACCEPT

&SOCKET ACCEPT ID=&SOCKETID TYPE=SYNC

Return Codes:

0

Accept successful

8

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

Notes:

When you are writing a server application, use &SOCKET REGISTER to start listening for incoming connection requests.

You would normally start another NCL process to handle the new connection and use &SOCKET TRANSFER_REQUEST to pass the connection to that process.

The &ZSOCID system variable contains the socket number to be used for communications with the client.

The port number and IP address of the remote system are available by referencing the &ZSOCPRT and &ZSOCHADR system variables.

Use TYPE=ASYNC so that your NCL process does not wait for connection requests in &SOCKET ACCEPT.

The &SOCKET ACCEPT verb is executed only by the server in client/server applications.

More information:

&SOCKET REGISTER

&SOCKET TRANSFER_REQUEST

&SOCKET TRANSFER_ACCEPT