ap
Dependencies: DnsQuery
Dependents: WizFi310_TCP_Echo_Server_Example
Fork of NetworkSocketAPI by
TCPSocket.cpp@30:3cc78f5db99d, 2016-02-22 (annotated)
- Committer:
- geky
- Date:
- Mon Feb 22 21:03:38 2016 +0000
- Branch:
- api-changes
- Revision:
- 30:3cc78f5db99d
- Parent:
- 28:163fbe3263f4
- Child:
- 32:2c5fc105fc50
Standardized formatting
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 |
28:163fbe3263f4 | 19 | TCPSocket::TCPSocket(NetworkInterface *iface) |
geky | 30:3cc78f5db99d | 20 | : Socket(iface, SOCK_TCP) |
geky | 30:3cc78f5db99d | 21 | { |
Christopher Haster |
22:4fca633c0633 | 22 | } |
Christopher Haster |
22:4fca633c0633 | 23 | |
geky | 30:3cc78f5db99d | 24 | int32_t TCPSocket::open() |
geky | 30:3cc78f5db99d | 25 | { |
Christopher Haster |
25:ed7b2a52e8ac | 26 | SocketInterface *s = _get_socket(); |
Christopher Haster |
25:ed7b2a52e8ac | 27 | if (!s) return -2; |
Christopher Haster |
25:ed7b2a52e8ac | 28 | return s->close(); |
Christopher Haster |
22:4fca633c0633 | 29 | } |
Christopher Haster |
22:4fca633c0633 | 30 | |
geky | 30:3cc78f5db99d | 31 | int32_t TCPSocket::close() |
geky | 30:3cc78f5db99d | 32 | { |
Christopher Haster |
25:ed7b2a52e8ac | 33 | SocketInterface *s = _get_socket(); |
Christopher Haster |
25:ed7b2a52e8ac | 34 | if (!s) return -2; |
Christopher Haster |
25:ed7b2a52e8ac | 35 | return s->close(); |
Christopher Haster |
22:4fca633c0633 | 36 | } |
Christopher Haster |
22:4fca633c0633 | 37 |