summaryrefslogtreecommitdiff
path: root/i/simulotron/src/socket
diff options
context:
space:
mode:
Diffstat (limited to 'i/simulotron/src/socket')
-rw-r--r--i/simulotron/src/socket/socket_client.cc6
-rw-r--r--i/simulotron/src/socket/socket_client.hh2
-rw-r--r--i/simulotron/src/socket/socket_server.cc6
-rw-r--r--i/simulotron/src/socket/socket_server.hh2
4 files changed, 16 insertions, 0 deletions
diff --git a/i/simulotron/src/socket/socket_client.cc b/i/simulotron/src/socket/socket_client.cc
index ef26e70..b8bdbc3 100644
--- a/i/simulotron/src/socket/socket_client.cc
+++ b/i/simulotron/src/socket/socket_client.cc
@@ -112,3 +112,9 @@ SocketClient::putChar (char c)
if (::write (socket_, &c, 1) < 0)
throw errno_exception ("SocketClient: erreur d'écriture (write()) ", errno);
}
+
+int
+SocketClient::getFD(void)
+{
+ return socket_;
+}
diff --git a/i/simulotron/src/socket/socket_client.hh b/i/simulotron/src/socket/socket_client.hh
index a024bec..de58bc5 100644
--- a/i/simulotron/src/socket/socket_client.hh
+++ b/i/simulotron/src/socket/socket_client.hh
@@ -54,6 +54,8 @@ class SocketClient
char getChar (void);
/// écrit un charactère dans le socket
void putChar (char c);
+ /// Récupère le FD du socket
+ int getFD (void);
};
#endif //socket_client_hh
diff --git a/i/simulotron/src/socket/socket_server.cc b/i/simulotron/src/socket/socket_server.cc
index 6014171..662abe0 100644
--- a/i/simulotron/src/socket/socket_server.cc
+++ b/i/simulotron/src/socket/socket_server.cc
@@ -68,3 +68,9 @@ SocketServer::accept (void)
return socket;
}
+
+int
+SocketServer::getFD (void)
+{
+ return socket_;
+}
diff --git a/i/simulotron/src/socket/socket_server.hh b/i/simulotron/src/socket/socket_server.hh
index 3b95949..30868e8 100644
--- a/i/simulotron/src/socket/socket_server.hh
+++ b/i/simulotron/src/socket/socket_server.hh
@@ -41,6 +41,8 @@ class SocketServer
void listen (int maxQueue);
/// accepte une connection et renvoie le fd
int accept (void);
+ /// récupère le FD du socket
+ int getFD (void);
};
#endif //socket_server_hh