increased chunk size

Dependencies:   HTTPClient-SSL

Fork of MTS-Socket by MultiTech

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers UDPSocket.h Source File

UDPSocket.h

00001 #ifndef UDPSOCKET_H
00002 #define UDPSOCKET_H
00003 
00004 #include "Endpoint.h"
00005 #include "Socket.h"
00006 
00007 /**
00008 UDP Socket
00009 */
00010 class UDPSocket: public Socket
00011 {
00012 
00013 public:
00014     /** Instantiate an UDP Socket.
00015     */
00016     UDPSocket();
00017 
00018     /** Init the UDP Client Socket without binding it to any specific port
00019     \return 0 on success, -1 on failure.
00020     */
00021     int init(void);
00022 
00023     /** Bind a UDP Server Socket to a specific port
00024     \param port The port to listen for incoming connections on
00025     \return 0 on success, -1 on failure.
00026     */
00027     int bind(int port = -1);
00028 
00029     /** Send a packet to a remote endpoint
00030     \param remote   The remote endpoint
00031     \param packet   The packet to be sent
00032     \param length   The length of the packet to be sent
00033     \return the number of written bytes on success (>=0) or -1 on failure
00034     */
00035     int sendTo(Endpoint &remote, char *packet, int length);
00036 
00037     /** Receive a packet from a remote endpoint
00038     \param remote   The remote endpoint
00039     \param buffer   The buffer for storing the incoming packet data. If a packet
00040            is too long to fit in the supplied buffer, excess bytes are discarded
00041     \param length   The length of the buffer
00042     \return the number of received bytes on success (>=0) or -1 on failure
00043     */
00044     int receiveFrom(Endpoint &remote, char *buffer, int length);
00045 };
00046 
00047 #endif