The TCP server socket API library module has the file name ipcsrv.c. This module provides a high level TCP socket interface for a TCP server application. The Unix version of this API uses the TCP Berkeley socket interprocess communication method. The Windows version of this API uses the Winsock interprocess communication method. This module contains global server and client socket data depending on the platform. The Future Lab TCP socket API library (both client and server) use the TCP connection oriented protocol.
Since the Future Lab QNX platform software does not (yet) use TCP for interprocess communication (QNX native message passing is the IPC), this module is not available for QNX.
Here is a list of functions in the TCP server socket API library module:
The following modules are required along with this module:
Just make sure you compile and link this module along with the other required modules.
This module requires the header files:
Prototype : int ipc_init(char *host_name, int port_number) Parameters : Name : host_name Description: host name of server (returned) Name : port_number Description: port number of server Returns : TRUE upon success, FALSE otherwise
This function will initialize the server socket, attempt to resolve the server host name by using a gethostname function call.
Prototype : int ipc_server_wait(void) Returns : TRUE upon successful client connection, FALSE otherwise
This function uses the accept socket function call to wait for a client connection. Note that the server program will block/wait for a connection.
Prototype : int ipc_recv_data(char *buf) Parameters : Name : buf Description: receive data buffer Returns : number of bytes received upon success, zero otherwise
This function will receive data from the client socket and place the data into the receive data buffer. The data is actually received by calling the low level TCP socket function ipc_recv.
Prototype : int ipc_send_data(char *buf) Parameters : Name : buf Description: send data buffer Returns : number of bytes sent upon success, zero otherwise
This function will send data through the client socket. The data is actually sent by calling the low level TCP socket function ipc_send.
Prototype : int ipc_close_client(void) Returns : TRUE upon success, FALSE otherwise
This function will close the client socket.
Prototype : int ipc_close(void) Returns : TRUE upon success, FALSE otherwise
This function will close the client and server sockets.
Prototype : void ipc_display_client(void)
This function will display the client socket pointer address. The function is used for debugging.