Modify changes to test TCP socket.

Dependents:   EthernetInterface

Fork of Socket by mbed official

Committer:
emilmont
Date:
Fri Mar 01 15:30:16 2013 +0000
Revision:
16:2d471deff212
Parent:
11:3d83c348fb8b
Add broadcasting and multicasting

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 16:2d471deff212 1 /* Copyright (C) 2012 mbed.org, MIT License
emilmont 16:2d471deff212 2 *
emilmont 16:2d471deff212 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
emilmont 16:2d471deff212 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
emilmont 16:2d471deff212 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
emilmont 16:2d471deff212 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
emilmont 16:2d471deff212 7 * furnished to do so, subject to the following conditions:
emilmont 16:2d471deff212 8 *
emilmont 16:2d471deff212 9 * The above copyright notice and this permission notice shall be included in all copies or
emilmont 16:2d471deff212 10 * substantial portions of the Software.
emilmont 16:2d471deff212 11 *
emilmont 16:2d471deff212 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
emilmont 16:2d471deff212 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
emilmont 16:2d471deff212 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
emilmont 16:2d471deff212 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
emilmont 16:2d471deff212 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
emilmont 16:2d471deff212 17 */
emilmont 16:2d471deff212 18 #ifndef ENDPOINT_H
emilmont 16:2d471deff212 19 #define ENDPOINT_H
emilmont 16:2d471deff212 20
emilmont 16:2d471deff212 21 class UDPSocket;
emilmont 16:2d471deff212 22
emilmont 16:2d471deff212 23 /**
emilmont 16:2d471deff212 24 IP Endpoint (address, port)
emilmont 16:2d471deff212 25 */
emilmont 16:2d471deff212 26 class Endpoint {
emilmont 16:2d471deff212 27 friend class UDPSocket;
emilmont 16:2d471deff212 28
emilmont 16:2d471deff212 29 public:
emilmont 16:2d471deff212 30 /** IP Endpoint (address, port)
emilmont 16:2d471deff212 31 */
emilmont 16:2d471deff212 32 Endpoint(void);
emilmont 16:2d471deff212 33
emilmont 16:2d471deff212 34 ~Endpoint(void);
emilmont 16:2d471deff212 35
emilmont 16:2d471deff212 36 /** Reset the address of this endpoint
emilmont 16:2d471deff212 37 */
emilmont 16:2d471deff212 38 void reset_address(void);
emilmont 16:2d471deff212 39
emilmont 16:2d471deff212 40 /** Set the address of this endpoint
emilmont 16:2d471deff212 41 \param host The endpoint address (it can either be an IP Address or a hostname that will be resolved with DNS).
emilmont 16:2d471deff212 42 \param port The endpoint port
emilmont 16:2d471deff212 43 \return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS).
emilmont 16:2d471deff212 44 */
emilmont 16:2d471deff212 45 int set_address(const char* host, const int port);
emilmont 16:2d471deff212 46
emilmont 16:2d471deff212 47 /** Get the IP address of this endpoint
emilmont 16:2d471deff212 48 \return The IP address of this endpoint.
emilmont 16:2d471deff212 49 */
emilmont 16:2d471deff212 50 char* get_address(void);
emilmont 16:2d471deff212 51
emilmont 16:2d471deff212 52 /** Get the port of this endpoint
emilmont 16:2d471deff212 53 \return The port of this endpoint
emilmont 16:2d471deff212 54 */
emilmont 16:2d471deff212 55 int get_port(void);
emilmont 16:2d471deff212 56
emilmont 16:2d471deff212 57 protected:
emilmont 16:2d471deff212 58 char _ipAddress[17];
emilmont 16:2d471deff212 59 struct sockaddr_in _remoteHost;
emilmont 16:2d471deff212 60
emilmont 16:2d471deff212 61 };
emilmont 16:2d471deff212 62
emilmont 16:2d471deff212 63 #endif