ap
Dependencies: DnsQuery
Dependents: WizFi310_TCP_Echo_Server_Example
Fork of NetworkSocketAPI by
Revision 126:636a06d0aa42, committed 2017-10-01
- Comitter:
- maru536
- Date:
- Sun Oct 01 20:55:24 2017 +0000
- Parent:
- 125:ea3a618e0818
- Commit message:
- merge1
Changed in this revision
--- a/NetworkStack.h Wed May 25 02:45:51 2016 +0000 +++ b/NetworkStack.h Sun Oct 01 20:55:24 2017 +0000 @@ -203,6 +203,7 @@ * @return 0 on success, negative error code on failure */ virtual int socket_connect(void *handle, const SocketAddress &address) = 0; + virtual int socket_connectSSL(void *handle, const SocketAddress &address) = 0; /** Accepts a connection on a TCP socket *
--- a/TCPSocket.cpp Wed May 25 02:45:51 2016 +0000 +++ b/TCPSocket.cpp Sun Oct 01 20:55:24 2017 +0000 @@ -50,6 +50,25 @@ return connect(addr); } +int TCPSocket::connectSSL(const char *host, uint16_t port) +{ + SocketAddress addr(_iface, host, port); + if (!addr) { + return NSAPI_ERROR_DNS_FAILURE; + } + + return connectSSL(addr); +} + +int TCPSocket::connectSSL(const SocketAddress &addr) +{ + if (!_socket) { + return NSAPI_ERROR_NO_SOCKET; + } + + return _iface->socket_connectSSL(_socket, addr); +} + int TCPSocket::send(const void *data, unsigned size) { mbed::Timer timer;
--- a/TCPSocket.h Wed May 25 02:45:51 2016 +0000 +++ b/TCPSocket.h Sun Oct 01 20:55:24 2017 +0000 @@ -83,6 +83,10 @@ * @return Number of sent bytes on success, negative error * code on failure */ + + int connectSSL(const SocketAddress &addr); + int connectSSL(const char *host, uint16_t port); + int send(const void *data, unsigned size); /** Receive data over a TCP socket