Code

client: Added sdb_client_sockfd() function.
authorSebastian Harl <sh@tokkee.org>
Sun, 12 Jan 2014 21:11:34 +0000 (22:11 +0100)
committerSebastian Harl <sh@tokkee.org>
Sun, 12 Jan 2014 21:11:34 +0000 (22:11 +0100)
This function returns the file-descriptor associated with the client's network
socket.

src/client/sock.c
src/include/client/sock.h

index a2417ad6d872029e8c80f51d83899b65e9026a06..49cefdf0935fb8315cda15c6b8921bbfa6d0a510 100644 (file)
@@ -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)
 {
index c88fc9a02041d2a7d0f06970428e17dfcb064c07..39e7622f3b1959fd1fbb1de11301adc25a1b842b 100644 (file)
@@ -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.