Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: TCPServer.cpp
- Revision:
- 9:1600369a29dd
- Parent:
- 7:43a7e8c0d6cc
- Child:
- 10:97d166c4a193
diff -r 9c6673c93082 -r 1600369a29dd TCPServer.cpp
--- a/TCPServer.cpp	Tue Apr 05 12:02:56 2016 -0500
+++ b/TCPServer.cpp	Tue Apr 05 12:52:07 2016 -0500
@@ -56,3 +56,22 @@
 
     return err;
 }
+
+
+void TCPServer::attach_accept(mbed::FuncPtr<void()> callback)
+{
+    _accept_cb = callback;
+
+    if (_socket && _accept_cb) {
+        return _iface->socket_attach_accept(_socket, Socket::thunk, &_accept_cb);
+    } else if (_socket) {
+        return _iface->socket_attach_accept(_socket, 0, 0);
+    }
+}
+
+TCPServer::~TCPServer()
+{
+    if (_socket && _accept_cb) {
+        _iface->socket_attach_accept(_socket, 0, 0);
+    }
+}