Prg_Ipc_Port_Connect_To()
Abstract
Connects to another program's listening PRG Ipc port and establish two-way communication.
Syntax
Prg_Ipc_Port_Connect_To (ip_addr, port_number, handler, ph_ptr)
| Argument | Type | Description |
|---|---|---|
ip_addr |
const char * |
the name or IP address of the host on which the listening program is running |
port_number |
int |
the IP port number of the listening program |
handler |
PrgT_Ipc_Packet_Handler | the handler that will be called when the listening program sends any data to this program |
ph_ptr |
PrgT_Ipc_Port_Handle * |
input argument, address of a port handle that will be filled with proper info |
Return Type
PrgT_Compcode
Return PrgC_Compcode_Success on success, PrgC_Compcode_Failure if failed
Header
prg_ipc.h
Details
Connect to another program listening on the given PRG Ipc port, thus establishing two-way communication with the listener.
For this function to succeed, the listener program must have called Prg_Ipc_Port_Create_Listen() to listen on the given port. The listening program may be running on a different host.
Once this function succeeds, the input argument ph_ptr will be filled with proper the information, so that the calling program can call Prg_Ipc_Packet_Send() on the PRG IPC port pointed to by ph_ptr to send data to the listener program. On the other side, the listener can call Prg_Ipc_Packet_Send() on its PRG IPC port handle (created through Prg_Ipc_Port_Create_Listen()) to send data to the calling program.
The prototype for handler is given in PrgT_Ipc_Packet_Handler.