rpc_sockaddr_to_name(3ncs)rpc_sockaddr_to_name(3ncs)Name
rpc_sockaddr_to_name - convert a socket address to a host name and port number (client or server)
Syntax
#include <idl/c/rpc.h>
void rpc_$sockaddr_to_name(sockaddr, slength, name, nlength, port, status)
socket_$addr_t *sockaddr;
unsigned long slength;
unsigned char name;
unsigned long *nlength;
unsigned long *port;
status_$t *status;
Arguments
sockaddr A socket address.
slength The length, in bytes, of sockaddr.
name A string that contains the host name and the address family. The format is family:host [port] where family is ip.
nlength On input, nlength is the length of the name buffer. On output, nlength is the number of characters returned in the
name parameter.
port The socket port number.
status The completion status. If the completion status returned in is equal to status_$ok , then the routine that supplied it
was successful.
Description
The routine provides the address family, the host name, and the port number identified by the specified socket address.
Diagnostics
This section lists status codes for errors returned by this routine in
rpc_$not_in_call An internal error.
rpc_$proto_error An internal protocol error. This routine has been superseded by the routine.
FilesSee Alsointro(3ncs), rpc_name_to_sockaddr(3ncs), socket_to_name(3ncs)rpc_sockaddr_to_name(3ncs)
Check Out this Related Man Page
rpc_use_family(3ncs)rpc_use_family(3ncs)Name
rpc_use_family - create a socket of a specified address family for a remote procedure call (RPC) server (server only)
Syntax
#include <idl/c/rpc.h>
void rpc_$use_family(family, sockaddr, slength, status)
unsigned long family;
socket_$addr_t *sockaddr;
unsigned long *slength;
status_$t *status;
Arguments
family The address family of the socket to be created. The value must be one of socket_$internet or socket_$unspec.
sockaddr The socket address of the socket on which the server will listen.
slength The length, in bytes, of sockaddr.
status The completion status. If the completion status returned in is equal to status_$ok , then the routine that supplied it was
successful.
Description
The routine creates a socket for a server without specifying its port number. The RPC runtime software assigns a port number. If a server
must listen on a particular well-known port, use to create the socket.
A server listens on one socket per address family, regardless of how many interfaces that it exports. Therefore, servers should make this
call once per supported address family.
Examples
The following statement creates a server's socket:
rpc_$use_family (family, &saddr, &slen, &status);
Diagnostics
This section lists status codes for errors returned by this routine in
rpc_$cant_create_sock
The RPC runtime library was unable to create a socket.
rpc_$not_in_call An internal error.
rpc_$proto_error An internal protocol error.
rpc_$too_many_sockets
The server is trying to use more than the maximum number of sockets that is allowed; it has called or too many times.
rpc_$addr_in_use The address and port specified in an routine are already in use. This is caused by multiple calls to with the same
well-known port.
FilesSee Alsointro(3ncs), rpc_use_family_wk(3ncs)rpc_use_family(3ncs)
What is the script that takes a port number as parameter and displays status, whether it is available or is already used by other process
pls help (1 Reply)
Hi all,
Situation is as below.
I would get an IP address and port from eithe r a file or command line. It probably would be as char * or string. So was wondering how I could accept this and increment the last octets?
Incrementing the port is fine. I could get that into an integer by atoi()... (8 Replies)
I'm trying to grab client's port number, by doing the following code:
//get client's port number - here we are not dealing with pointers
//because the returned value will be passed as a parameter to htons()
//htons() takes u_short, which is similar to short, parameter
short... (1 Reply)