ap
Dependencies: DnsQuery
Dependents: WizFi310_TCP_Echo_Server_Example
Fork of NetworkSocketAPI by
Diff: TCPSocket.h
- Revision:
- 81:1600369a29dd
- Parent:
- 80:9c6673c93082
- Child:
- 89:b1d417383c0d
diff -r 9c6673c93082 -r 1600369a29dd TCPSocket.h --- a/TCPSocket.h Tue Apr 05 12:02:56 2016 -0500 +++ b/TCPSocket.h Tue Apr 05 12:52:07 2016 -0500 @@ -28,6 +28,7 @@ /** TCP socket lifetime */ TCPSocket(NetworkInterface *iface); + virtual ~TCPSocket(); /** Connects this TCP socket to the server \param host The host to connect to. It can either be an IP Address @@ -68,14 +69,27 @@ */ void attach_send(mbed::FuncPtr<void()> callback); + template <typename T, typename M> + void attach_send(T *tptr, M mptr) { + attach_send(mbed::FuncPtr<void()>(tptr, mptr)); + } + /** Register a callback on when recv is ready \param callback Function to call when recv will succeed, may be called in interrupt context. */ void attach_recv(mbed::FuncPtr<void()> callback); + template <typename T, typename M> + void attach_recv(T *tptr, M mptr) { + attach_recv(mbed::FuncPtr<void()>(tptr, mptr)); + } + private: friend class TCPServer; + + mbed::FuncPtr<void()> _send_cb; + mbed::FuncPtr<void()> _recv_cb; }; #endif