Hi all.
I don`t know if it`s write place to write, sorry if it`s not.

I am trying to write some application that uses netgraph framework, and
stuck on getting information from ng_ksocket node.
It is server ng_ksocket node that clones itself on each connection
(client), I get this cloned nodes id (something like [4ab]:) and store it
in array.
I want from time to time check if somebody connected to each of this nodes,
and for that I am trying to use something like that :
if (NgSendMsg(csock, pth, NGM_KSOCKET_COOKIE, NGM_KSOCKET_GETPEERNAME,
NULL, 0) == -1) {
if  (errno == ENOTCONN) {
syslog(LOG_INFO, "check_and_clear(): Socket not connected, node: %s will be
shutdown", pth);
ShutNode(pth);
memset(clients[i], 0, sizeof(clients[i]));
} else if (errno == ENOENT) {
syslog(LOG_NOTICE, "check_and_clear(): Node already closed %s", pth);
memset(clients[i], 0, sizeof(clients[i]));
} else {
syslog(LOG_ERR, "check_and_clear(): An error has occured while getpeername
from node: %s, %s", pth, strerror(errno));
}
}
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to