int
main(int argc, char*argv[])
{
int rpcversion = 54321;
char *netType4 = (char*)"tcp";
char *netType6 = (char*)"tcp6";
struct netconfig * netConfig4 = getnetconfigent(netType4);
struct netconfig * netConfig6 = getnetconfigent(netType6);
int result = svc_create(messageHandler, rpcversion, 4, "tcp");
cout<<"Created "<<result<<" interfaces"<<endl;
netbuf buf;
buf.buf = (char*) malloc(256);
buf.maxlen = 256;
//
// First we try with ipv6
//
bool bresult = rpcb_getaddr( rpcversion, 4, netConfig6, &buf, "::
1" );
sockaddr_in* sock = (sockaddr_in*)buf.buf;
if ( bresult == true )
{
printf("v6 result is %d\n", sock->sin_port);
}
bool bresult2 = rpcb_getaddr( rpcversion, 4, netConfig4, &buf,
"127.0.0.1" );
sockaddr_in* sock2 = (sockaddr_in*)buf.buf;
if ( bresult2 == true )
{
printf("v4 result is %d\n", sock2->sin_port);
}
}
Output:
Created 2 interfaces
v4 result is 32977
(notice to v6 result)
Each time svc_create shows it created 2 connections. rpcinfo shows
both...
54321 4 tcp6 ::.128.202 - 365
54321 4 tcp 0.0.0.0.128.203 - 365
But rpcb_getaddr only returns the IPv4 connection.
How can I further debug this?
-robert
Hi Robert,
this looks a little bit like the issue I am having with getnameinfo (see
my earlier post to cus from 5th of November). I also get a valid
connection but getnameinfo always fails.
You could truss the relevant process with '-u libsocket', then
getnameinfo queries should show up. If they return a value != 0 this
means an error. I am always getting a return value of 5.
- Thomas