From e13cc7f193e3150ebad5b16ff349896042e1389a Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sun, 12 Jan 2014 22:11:34 +0100 Subject: [PATCH] client: Added sdb_client_sockfd() function. This function returns the file-descriptor associated with the client's network socket. --- src/client/sock.c | 8 ++++++++ src/include/client/sock.h | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/src/client/sock.c b/src/client/sock.c index a2417ad..49cefdf 100644 --- a/src/client/sock.c +++ b/src/client/sock.c @@ -190,6 +190,14 @@ sdb_client_connect(sdb_client_t *client, const char *username) return 0; } /* sdb_client_connect */ +int +sdb_client_sockfd(sdb_client_t *client) +{ + if (! client) + return -1; + return client->fd; +} /* sdb_client_sockfd */ + void sdb_client_close(sdb_client_t *client) { diff --git a/src/include/client/sock.h b/src/include/client/sock.h index c88fc9a..39e7622 100644 --- a/src/include/client/sock.h +++ b/src/include/client/sock.h @@ -76,6 +76,13 @@ sdb_client_destroy(sdb_client_t *client); int sdb_client_connect(sdb_client_t *client, const char *username); +/* + * sdb_client_sockfd: + * Return the client socket's file descriptor. + */ +int +sdb_client_sockfd(sdb_client_t *client); + /* * sdb_client_close: * Close the client connection. -- 2.30.2