gtpc1m3jTransmission Control Protocol/Internet Protocol

activate_on_receipt -- Activate a Program after Data Received

The activate_on_receipt function allows the issuing ECB to exit and activate a different ECB at the program specified after information has been received.

Format

#include <socket.h>
int      activate_on_receipt(unsigned int s,
                            unsigned char *parm,
                            unsigned char *pgm);

s
The socket descriptor.

parm
A pointer to an 8-byte field. The data in this field is saved and passed to a new ECB starting at EBW004. This new ECB is created after information has been received.

pgm
A pointer to a 4-byte field that contains the name of the TPF real-time program to be activated after information has been received.

Normal Return

Return code 0 indicates that the function was successful.

Error Return

Return code -1 indicates an error. You can get the specific error code by calling sock_errno. See Appendix C, Socket Error Return Codes for more information about socket errors.

Note:
Unless otherwise stated in the description, the following error codes can be returned for either TCP/IP offload support or TCP/IP native stack support.

Value
Description

SOCNOTSOCK
The s parameter is not a valid socket descriptor.

E1052STATE
The socket was closed because the system was in or cycling down to 1052 state.

EINACT
All offload devices associated with the socket descriptor have been disconnected. The socket is closed. This error code is returned only for TCP/IP offload support.

EINACTWS
An offload device associated with the socket descriptor has been disconnected. The socket is still available. This error code is returned only for TCP/IP offload support.

ESYSTEMERROR
The system closed the socket because pgm is a program name that does not exist.

SOCNOBUFS
There is not enough buffer space to issue the function call. This error code is returned only for TCP/IP offload support.

SOCNOTCONN
The s socket is a stream socket, but the socket is not connected.

SOCINVAL
The listen function was not called for socket s or the read, recv, or recvfrom function is already pending for socket s.

EIBMIUCVERR
The activate_on_receipt function was not successful because an error occurred when the message was sent to the offload device. This error code is returned only for TCP/IP offload support.

SOCTIMEDOUT
The operation timed out. The socket is still available. This error code is returned only for TCP/IP native stack support.

Programming Considerations

Examples

After accepting a connection from a new client, an activate_on_receipt function is issued so that server_sock can accept the next client request.

#include <types.h>
#include <socket.h>

·
·
·
int newclient_sock; int server_sock; u_char aorparm[8]; u_char aorpgm[4] = "abcd";
·
·
·
for(;;) { newclient_sock = accept(server_sock,(struct sockaddr *)0,(int)0);
·
·
·
/* No parameters will be passed to the new ECB */ memset(aorparm,0,sizeof(aorparm)); rc = activate_on_receipt(newclient_sock,aorparm,aorpgm);
·
·
·
}

Related Information