nc_connect_inout
Is anybody using this or can provide an example of how to use? Or tell me if I'm using it inappropriately. I am trying to establish a NETCONF session between a server and a client on the same machine.
In my client, when I replace a working SSH connect:
s = nc_connect_ssh("localhost", 0, NULL);
with:
int sock[2];
socketpair(AF_UNIX, SOCK_STREAM, 0, sock);
s = nc_connect_inout(sock[0], sock[1], NULL);
NULL is returned and libnetconf2 reports: Missing <session-id> in server's <hello>. Debug logging seems to show messages flowing in both directions, it just looks like the server reply fails validation. Any information is appreciated. Thanks,
-- Kevin
Hi Kevin,
you always need both a client and a server. You effectively made a client talk with itself so it reads weird messages, naturally. You want to pass one socket for both input and output of nc_connect_inout and another for both input and output of nc_accept_inout (server-side).
Regards, Michal
Got it. Thanks!
-- Kevin