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.
Dependents: NetRelais TCP_Client_Example TCP_Server_Example UDP_Server_Example ... more
udp/socket.hpp@9:7ac7c29fea3d, 2014-11-15 (annotated)
- Committer:
- NegativeBlack
- Date:
- Sat Nov 15 21:35:31 2014 +0000
- Revision:
- 9:7ac7c29fea3d
- Parent:
- 6:847a0b218e22
Fixed type warnings in address::formString().
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| NegativeBlack | 0:00d5bc4b46e1 | 1 | /** |
| NegativeBlack | 0:00d5bc4b46e1 | 2 | * Copyright (c) 2012, Roy van Dam <roy@vandam-innovations.com> |
| NegativeBlack | 0:00d5bc4b46e1 | 3 | * All rights reserved. |
| NegativeBlack | 0:00d5bc4b46e1 | 4 | * |
| NegativeBlack | 0:00d5bc4b46e1 | 5 | * Redistribution and use in source and binary forms, with or without |
| NegativeBlack | 0:00d5bc4b46e1 | 6 | * modification, are permitted provided that the following conditions are met: |
| NegativeBlack | 0:00d5bc4b46e1 | 7 | * |
| NegativeBlack | 0:00d5bc4b46e1 | 8 | * 1. Redistributions of source code must retain the above copyright notice, this |
| NegativeBlack | 0:00d5bc4b46e1 | 9 | * list of conditions and the following disclaimer. |
| NegativeBlack | 0:00d5bc4b46e1 | 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| NegativeBlack | 0:00d5bc4b46e1 | 11 | * this list of conditions and the following disclaimer in the documentation |
| NegativeBlack | 0:00d5bc4b46e1 | 12 | * and/or other materials provided with the distribution. |
| NegativeBlack | 0:00d5bc4b46e1 | 13 | * |
| NegativeBlack | 0:00d5bc4b46e1 | 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| NegativeBlack | 0:00d5bc4b46e1 | 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| NegativeBlack | 0:00d5bc4b46e1 | 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| NegativeBlack | 0:00d5bc4b46e1 | 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
| NegativeBlack | 0:00d5bc4b46e1 | 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| NegativeBlack | 0:00d5bc4b46e1 | 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| NegativeBlack | 0:00d5bc4b46e1 | 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| NegativeBlack | 0:00d5bc4b46e1 | 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| NegativeBlack | 0:00d5bc4b46e1 | 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| NegativeBlack | 0:00d5bc4b46e1 | 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| NegativeBlack | 0:00d5bc4b46e1 | 24 | */ |
| NegativeBlack | 0:00d5bc4b46e1 | 25 | |
| NegativeBlack | 0:00d5bc4b46e1 | 26 | #ifndef _NETWORK_UDP_SOCKET_HPP_ |
| NegativeBlack | 0:00d5bc4b46e1 | 27 | #define _NETWORK_UDP_SOCKET_HPP_ |
| NegativeBlack | 0:00d5bc4b46e1 | 28 | |
| NegativeBlack | 6:847a0b218e22 | 29 | #include "../buffer.hpp" |
| NegativeBlack | 1:6956f6f96fef | 30 | #include "../socket.hpp" |
| NegativeBlack | 1:6956f6f96fef | 31 | #include "../ip/address.hpp" |
| NegativeBlack | 0:00d5bc4b46e1 | 32 | |
| NegativeBlack | 0:00d5bc4b46e1 | 33 | namespace network { |
| NegativeBlack | 0:00d5bc4b46e1 | 34 | namespace udp { |
| NegativeBlack | 0:00d5bc4b46e1 | 35 | |
| NegativeBlack | 0:00d5bc4b46e1 | 36 | class Socket : |
| NegativeBlack | 0:00d5bc4b46e1 | 37 | public network::Socket |
| NegativeBlack | 0:00d5bc4b46e1 | 38 | { |
| NegativeBlack | 0:00d5bc4b46e1 | 39 | public: |
| NegativeBlack | 0:00d5bc4b46e1 | 40 | int open(); |
| NegativeBlack | 0:00d5bc4b46e1 | 41 | |
| NegativeBlack | 6:847a0b218e22 | 42 | int send(Buffer &buffer, ip::Address &address, int port); |
| NegativeBlack | 6:847a0b218e22 | 43 | int send(Buffer &buffer, ip::Endpoint &endpoint); |
| NegativeBlack | 2:e283a0062097 | 44 | int send(void *data, size_t size, ip::Address &address, int port); |
| NegativeBlack | 0:00d5bc4b46e1 | 45 | int send(void *data, size_t size, ip::Endpoint &endpoint); |
| NegativeBlack | 0:00d5bc4b46e1 | 46 | |
| NegativeBlack | 6:847a0b218e22 | 47 | int receive(Buffer &buffer); |
| NegativeBlack | 3:d30db8752485 | 48 | int receive(void *data, size_t max_size); |
| NegativeBlack | 3:d30db8752485 | 49 | int receive(void *data, size_t max_size, ip::Endpoint &endpoint); |
| NegativeBlack | 0:00d5bc4b46e1 | 50 | }; |
| NegativeBlack | 0:00d5bc4b46e1 | 51 | |
| NegativeBlack | 0:00d5bc4b46e1 | 52 | } // namespace udp |
| NegativeBlack | 0:00d5bc4b46e1 | 53 | } // namespace network |
| NegativeBlack | 0:00d5bc4b46e1 | 54 | |
| NegativeBlack | 0:00d5bc4b46e1 | 55 | #endif // _NETWORK_UDP_SOCKET_HPP_ |