summaryrefslogtreecommitdiffstats
path: root/src/TcpSocket.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-11-05 15:00:39 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-11-05 15:00:39 +0100
commit8e609435fc61f543fdc98c78a5fdbeb30af7dadc (patch)
tree98124da31e336be12cabeacd5a07f3bc3303a996 /src/TcpSocket.h
parent5fd4d99aded3677497c6cf5ab31517a5383333cb (diff)
parent5c12d5b387e07203be79df7e4d526d124a53ad8a (diff)
downloaddabmux-8e609435fc61f543fdc98c78a5fdbeb30af7dadc.tar.gz
dabmux-8e609435fc61f543fdc98c78a5fdbeb30af7dadc.tar.bz2
dabmux-8e609435fc61f543fdc98c78a5fdbeb30af7dadc.zip
Merge branch 'next' into inputrework
Diffstat (limited to 'src/TcpSocket.h')
-rw-r--r--src/TcpSocket.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/TcpSocket.h b/src/TcpSocket.h
index 8df913f..660515d 100644
--- a/src/TcpSocket.h
+++ b/src/TcpSocket.h
@@ -46,7 +46,7 @@
#include <iostream>
#include <string>
-#include <boost/optional.hpp>
+#include <memory>
/**
* This class represents a TCP socket.
@@ -70,7 +70,9 @@ class TcpSocket
TcpSocket(const TcpSocket& other) = delete;
TcpSocket& operator=(const TcpSocket& other) = delete;
- int close();
+ bool isValid(void);
+
+ int close(void);
/** Send data over the TCP connection.
* @param data The buffer that will be sent.
@@ -88,7 +90,12 @@ class TcpSocket
void listen(void);
TcpSocket accept(void);
- boost::optional<TcpSocket> accept(int timeout_ms);
+
+ /* Returns either valid socket if a connection was
+ * accepted before the timeout expired, or an invalid
+ * socket otherwise.
+ */
+ TcpSocket accept(int timeout_ms);
/** Retrieve address this socket is bound to */
InetAddress getOwnAddress() const;