The following code example shows calls to clnt_vc_create() and clnt_dg_create().
/*
* variables are:
* cl: CLIENT *
* tinfo: struct t_info returned from either t_open or t_getinfo
* svcaddr: struct netbuf *
*/
switch(tinfo.servtype) {
case T_COTS:
case T_COTS_ORD:
cl = clnt_vc_create(fd, svcaddr,
prog, vers, sendsz, recvsz);
break;
case T_CLTS:
cl = clnt_dg_create(fd, svcaddr,
prog, vers, sendsz, recvsz);
break;
default:
goto err;
}
These routines require that the file descriptor be open and bound. svcaddr is the address of the server.