[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 1

clnttcp_create Subroutine


Creates a Transmission Control Protocol/Internet Protocol (TCP/IP) client transport handle.


C Library (libc.a)


CLIENT *clnttcp_create (addr, prognum, versnum, sockp, sendsz, recvsz)
struct sockaddr_in * addr;
u_long prognum, versnum;
int * sockp;
u_int sendsz, recvsz;


The clnttcp_create subroutine creates a Remote Procedure Call (RPC) client transport handle for a remote program. This client uses TCP/IP as the transport to pass messages to the service.

The TCP/IP remote procedure calls use buffered input/output (I/O). Users can set the size of the send and receive buffers with the sendsz and recvsz parameters. If the size of either buffer is set to a value of 0, the svctcp_create subroutine picks suitable default values.


addr Points to the Internet address of the remote program. If the port number for this Internet address (addr->sin_port) is a value of 0, then the addr parameter is set to the actual port on which the remote program is listening. The client making the remote procedure call consults the remote portmap daemon to obtain the port information.
prognum Specifies the program number of the remote program.
versnum Specifies the version number of the remote program.
sockp Specifies a pointer to a socket. If the value of the sockp parameter is RPC_ANYSOCK, the clnttcp_create subroutine opens a new socket and sets the sockp pointer to the new socket.
sendsz Sets the size of the send buffer.
recvsz Sets the size of the receive buffer.

Return Values

Upon successful completion, this routine returns a valid TCP/IP client handle. If unsuccessful, it returns a value of null.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The callrpc subroutine, clnt_pcreateerror subroutine, clntudp_create subroutine, svctcp_create subroutine.

The portmap daemon.

The clnt_call macro.

List of RPC Programming References.

TCP/IP Protocols in AIX 5L Version 5.1 System Management Guide: Communications and Networks.

Remote Procedure Call (RPC) Overview for Programming and Sockets Overview in AIX 5L Version 5.1 Communications Programming Concepts.

[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]