gtpc1m3kTransmission Control Protocol/Internet Protocol

activate_on_receipt_with_length -- Activate a Program after Data of Specified Length Received

The activate_on_receipt_with_length function allows the issuing entry control block (ECB) to exit and activate a different ECB at the program specified after information with a specified length has been received.

Format

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

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.

len
The length of data to be read before giving control to the new ECB.

Normal Return

Return code 0 indicates that the function was successful.

Error Return

A return code equal to -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
A system error has occurred and closed the socket.

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.

EIBMIUCVERR
The activate_on_receipt_with_length 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_with_length 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; int aor_len = 4; 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)); /* read 1st 4 bytes of message. This can be useful, for */ /* example, if the application puts the message length in the */ /* first 4 bytes of message. The aor will read the 1st 4 */ /* bytes to get the message length, then issue subsequent */ /* reads for the rest of the data. */ rc = activate_on_receipt_with_length(newclient_sock,aorparm,aorpgm,aor_len);
·
·
·
}

Related Information