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
socket_from_name(3ncs)socket_from_name(3ncs)Name
socket_from_name - convert a name and port number to a socket address
Syntax
#include <idl/c/socket.h>
void socket_$from_name(family, name, nlength, port, sockaddr, slength, status)
unsigned long family;
socket_$string_t name;
unsigned long nlength;
unsigned long port;
socket_$addr_t *sockaddr;
unsigned long *slength;
status_$t *status;
Arguments
family The integer representation of an address family. Value can be socket_$internet or socket_$unspec If the family parameter is
socket_$unspec, then the name parameter is scanned for a prefix of family: (for example, ip:).
name A string in the format family:host[port], where family:, host, and [port] are all optional. The family is an address family. The
only valid family is ip. If you specify a family as part of the name parameter, you must specify socket_$unspec in the family
parameter. The host is a host name. A leading number sign (#) can be used to indicate that the host name is in the standard
numeric form (for example, #192.9.8.7). If host is omitted, the local host name is used. The port is a port number. If you spec-
ify a port as part of the name parameter, the port parameter is ignored.
nlength
The length, in bytes, of name.
port A port number. If you specify a port number in the name parameter, this parameter is ignored.
sockaddr
A socket address.
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 success-
ful.
Description
The routine converts a textual address family, host name, and port number to a socket address. The address family and the port number can
be either specified as separate parameters or included in the name parameter.
FilesSee Alsointro(3ncs), socket_family_from_name(3ncs), socket_to_name(3ncs)socket_from_name(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)