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.
Dependencies: DnsQuery
Dependents: TempTower BSDInterfaceTests HelloBSDInterface ESP8266InterfaceTests ... more
TCPSocket.cpp@25:ed7b2a52e8ac, 2016-02-18 (annotated)
- Committer:
- Christopher Haster
- Date:
- Thu Feb 18 06:01:55 2016 -0600
- Branch:
- api-changes
- Revision:
- 25:ed7b2a52e8ac
- Parent:
- 24:a5e959bdd2dd
- Child:
- 28:163fbe3263f4
Added abstract base case for Sockets
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Christopher Haster |
22:4fca633c0633 | 1 | /* TCPSocket |
| Christopher Haster |
22:4fca633c0633 | 2 | * Copyright (c) 2015 ARM Limited |
| Christopher Haster |
22:4fca633c0633 | 3 | * |
| Christopher Haster |
22:4fca633c0633 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| Christopher Haster |
22:4fca633c0633 | 5 | * you may not use this file except in compliance with the License. |
| Christopher Haster |
22:4fca633c0633 | 6 | * You may obtain a copy of the License at |
| Christopher Haster |
22:4fca633c0633 | 7 | * |
| Christopher Haster |
22:4fca633c0633 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| Christopher Haster |
22:4fca633c0633 | 9 | * |
| Christopher Haster |
22:4fca633c0633 | 10 | * Unless required by applicable law or agreed to in writing, software |
| Christopher Haster |
22:4fca633c0633 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| Christopher Haster |
22:4fca633c0633 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| Christopher Haster |
22:4fca633c0633 | 13 | * See the License for the specific language governing permissions and |
| Christopher Haster |
22:4fca633c0633 | 14 | * limitations under the License. |
| Christopher Haster |
22:4fca633c0633 | 15 | */ |
| Christopher Haster |
22:4fca633c0633 | 16 | |
| Christopher Haster |
22:4fca633c0633 | 17 | #include "TCPSocket.h" |
| Christopher Haster |
22:4fca633c0633 | 18 | |
| Christopher Haster |
25:ed7b2a52e8ac | 19 | TCPSocket::TCPSocket(NetworkInterface *iface, const char *url, uint16_t port) |
| Christopher Haster |
25:ed7b2a52e8ac | 20 | : Socket(iface, SOCK_TCP, url, port) { |
| Christopher Haster |
22:4fca633c0633 | 21 | } |
| Christopher Haster |
22:4fca633c0633 | 22 | |
| Christopher Haster |
22:4fca633c0633 | 23 | int32_t TCPSocket::open() { |
| Christopher Haster |
25:ed7b2a52e8ac | 24 | SocketInterface *s = _get_socket(); |
| Christopher Haster |
25:ed7b2a52e8ac | 25 | if (!s) return -2; |
| Christopher Haster |
25:ed7b2a52e8ac | 26 | return s->close(); |
| Christopher Haster |
22:4fca633c0633 | 27 | } |
| Christopher Haster |
22:4fca633c0633 | 28 | |
| Christopher Haster |
22:4fca633c0633 | 29 | int32_t TCPSocket::close() { |
| Christopher Haster |
25:ed7b2a52e8ac | 30 | SocketInterface *s = _get_socket(); |
| Christopher Haster |
25:ed7b2a52e8ac | 31 | if (!s) return -2; |
| Christopher Haster |
25:ed7b2a52e8ac | 32 | return s->close(); |
| Christopher Haster |
22:4fca633c0633 | 33 | } |
| Christopher Haster |
22:4fca633c0633 | 34 |