summaryrefslogtreecommitdiff
path: root/src/libstddjb/socket_timeoutconn.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb/socket_timeoutconn.c')
-rw-r--r--src/libstddjb/socket_timeoutconn.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libstddjb/socket_timeoutconn.c b/src/libstddjb/socket_timeoutconn.c
new file mode 100644
index 0000000..ec7e251
--- /dev/null
+++ b/src/libstddjb/socket_timeoutconn.c
@@ -0,0 +1,13 @@
+/* ISC license. */
+
+#include <skalibs/uint16.h>
+#include <skalibs/tai.h>
+#include <skalibs/socket.h>
+
+int socket_timeoutconn (int s, char const *ip, uint16 port, unsigned int timeout)
+{
+ tain_t stamp, deadline ;
+ tain_now(&stamp) ;
+ tain_addsec(&deadline, &stamp, timeout) ;
+ return socket_deadlineconnstamp4(s, ip, port, &deadline, &stamp) ;
+}