ソースの整理中ですが、利用はできます。 大きなファイルはできないかもしれません。

Dependencies:   EthernetInterface HttpServer TextLCD expatlib mbed-rpc mbed-rtos mbed Socket lwip-eth lwip-sys lwip

Fork of giken9_HTMLServer_Sample by Yasushi TAUCHI

Committer:
yueee_yt
Date:
Wed Mar 12 06:30:30 2014 +0000
Revision:
2:6f25f8327180
Parent:
0:7766f6712673
debug comment

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yueee_yt 0:7766f6712673 1 /* Copyright (C) 2012 mbed.org, MIT License
yueee_yt 0:7766f6712673 2 *
yueee_yt 0:7766f6712673 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
yueee_yt 0:7766f6712673 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
yueee_yt 0:7766f6712673 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
yueee_yt 0:7766f6712673 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
yueee_yt 0:7766f6712673 7 * furnished to do so, subject to the following conditions:
yueee_yt 0:7766f6712673 8 *
yueee_yt 0:7766f6712673 9 * The above copyright notice and this permission notice shall be included in all copies or
yueee_yt 0:7766f6712673 10 * substantial portions of the Software.
yueee_yt 0:7766f6712673 11 *
yueee_yt 0:7766f6712673 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
yueee_yt 0:7766f6712673 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
yueee_yt 0:7766f6712673 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
yueee_yt 0:7766f6712673 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
yueee_yt 0:7766f6712673 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
yueee_yt 0:7766f6712673 17 */
yueee_yt 0:7766f6712673 18
yueee_yt 0:7766f6712673 19 #ifndef UDPSOCKET_H
yueee_yt 0:7766f6712673 20 #define UDPSOCKET_H
yueee_yt 0:7766f6712673 21
yueee_yt 0:7766f6712673 22 #include "Socket/Socket.h"
yueee_yt 0:7766f6712673 23 #include "Socket/Endpoint.h"
yueee_yt 0:7766f6712673 24
yueee_yt 0:7766f6712673 25 /**
yueee_yt 0:7766f6712673 26 UDP Socket
yueee_yt 0:7766f6712673 27 */
yueee_yt 0:7766f6712673 28 class UDPSocket : public Socket {
yueee_yt 0:7766f6712673 29
yueee_yt 0:7766f6712673 30 public:
yueee_yt 0:7766f6712673 31 /** Instantiate an UDP Socket.
yueee_yt 0:7766f6712673 32 */
yueee_yt 0:7766f6712673 33 UDPSocket();
yueee_yt 0:7766f6712673 34
yueee_yt 0:7766f6712673 35 /** Init the UDP Client Socket without binding it to any specific port
yueee_yt 0:7766f6712673 36 \return 0 on success, -1 on failure.
yueee_yt 0:7766f6712673 37 */
yueee_yt 0:7766f6712673 38 int init(void);
yueee_yt 0:7766f6712673 39
yueee_yt 0:7766f6712673 40 /** Bind a UDP Server Socket to a specific port
yueee_yt 0:7766f6712673 41 \param port The port to listen for incoming connections on
yueee_yt 0:7766f6712673 42 \return 0 on success, -1 on failure.
yueee_yt 0:7766f6712673 43 */
yueee_yt 0:7766f6712673 44 int bind(int port);
yueee_yt 0:7766f6712673 45
yueee_yt 0:7766f6712673 46 /** Join the multicast group at the given address
yueee_yt 0:7766f6712673 47 \param address The address of the multicast group
yueee_yt 0:7766f6712673 48 \return 0 on success, -1 on failure.
yueee_yt 0:7766f6712673 49 */
yueee_yt 0:7766f6712673 50 int join_multicast_group(const char* address);
yueee_yt 0:7766f6712673 51
yueee_yt 0:7766f6712673 52 /** Set the socket in broadcasting mode
yueee_yt 0:7766f6712673 53 \return 0 on success, -1 on failure.
yueee_yt 0:7766f6712673 54 */
yueee_yt 0:7766f6712673 55 int set_broadcasting(bool broadcast=true);
yueee_yt 0:7766f6712673 56
yueee_yt 0:7766f6712673 57 /** Send a packet to a remote endpoint
yueee_yt 0:7766f6712673 58 \param remote The remote endpoint
yueee_yt 0:7766f6712673 59 \param packet The packet to be sent
yueee_yt 0:7766f6712673 60 \param length The length of the packet to be sent
yueee_yt 0:7766f6712673 61 \return the number of written bytes on success (>=0) or -1 on failure
yueee_yt 0:7766f6712673 62 */
yueee_yt 0:7766f6712673 63 int sendTo(Endpoint &remote, char *packet, int length);
yueee_yt 0:7766f6712673 64
yueee_yt 0:7766f6712673 65 /** Receive a packet from a remote endpoint
yueee_yt 0:7766f6712673 66 \param remote The remote endpoint
yueee_yt 0:7766f6712673 67 \param buffer The buffer for storing the incoming packet data. If a packet
yueee_yt 0:7766f6712673 68 is too long to fit in the supplied buffer, excess bytes are discarded
yueee_yt 0:7766f6712673 69 \param length The length of the buffer
yueee_yt 0:7766f6712673 70 \return the number of received bytes on success (>=0) or -1 on failure
yueee_yt 0:7766f6712673 71 */
yueee_yt 0:7766f6712673 72 int receiveFrom(Endpoint &remote, char *buffer, int length);
yueee_yt 0:7766f6712673 73 };
yueee_yt 0:7766f6712673 74
yueee_yt 0:7766f6712673 75 #endif