increased chunk size

Dependencies:   HTTPClient-SSL

Fork of MTS-Socket by MultiTech

Committer:
mfiore
Date:
Tue Jun 17 21:59:55 2014 +0000
Revision:
9:b2e3862705fc
Parent:
2:ebc6129de4e8
Child:
20:a74e92329ba6
add UDP socket code; add UDP unit test; remove specific info from tests

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mfiore 0:eef30dbe1130 1 #ifndef UDPSOCKET_H
mfiore 0:eef30dbe1130 2 #define UDPSOCKET_H
mfiore 0:eef30dbe1130 3
mfiore 9:b2e3862705fc 4 #include "Endpoint.h"
mfiore 9:b2e3862705fc 5 #include "Socket.h"
mfiore 9:b2e3862705fc 6
mfiore 9:b2e3862705fc 7 #include <cstdint>
mfiore 9:b2e3862705fc 8
mfiore 9:b2e3862705fc 9 /**
mfiore 9:b2e3862705fc 10 UDP Socket
mfiore 9:b2e3862705fc 11 */
mfiore 9:b2e3862705fc 12 class UDPSocket: public Socket
mfiore 9:b2e3862705fc 13 {
mfiore 9:b2e3862705fc 14
mfiore 9:b2e3862705fc 15 public:
mfiore 9:b2e3862705fc 16 /** Instantiate an UDP Socket.
mfiore 9:b2e3862705fc 17 */
mfiore 9:b2e3862705fc 18 UDPSocket();
mfiore 9:b2e3862705fc 19
mfiore 9:b2e3862705fc 20 /** Init the UDP Client Socket without binding it to any specific port
mfiore 9:b2e3862705fc 21 \return 0 on success, -1 on failure.
mfiore 9:b2e3862705fc 22 */
mfiore 9:b2e3862705fc 23 int init(void);
mfiore 9:b2e3862705fc 24
mfiore 9:b2e3862705fc 25 /** Bind a UDP Server Socket to a specific port
mfiore 9:b2e3862705fc 26 \param port The port to listen for incoming connections on
mfiore 9:b2e3862705fc 27 \return 0 on success, -1 on failure.
mfiore 9:b2e3862705fc 28 */
mfiore 9:b2e3862705fc 29 int bind(int port = -1);
mfiore 9:b2e3862705fc 30
mfiore 9:b2e3862705fc 31 /** Send a packet to a remote endpoint
mfiore 9:b2e3862705fc 32 \param remote The remote endpoint
mfiore 9:b2e3862705fc 33 \param packet The packet to be sent
mfiore 9:b2e3862705fc 34 \param length The length of the packet to be sent
mfiore 9:b2e3862705fc 35 \return the number of written bytes on success (>=0) or -1 on failure
mfiore 9:b2e3862705fc 36 */
mfiore 9:b2e3862705fc 37 int sendTo(Endpoint &remote, char *packet, int length);
mfiore 9:b2e3862705fc 38
mfiore 9:b2e3862705fc 39 /** Receive a packet from a remote endpoint
mfiore 9:b2e3862705fc 40 \param remote The remote endpoint
mfiore 9:b2e3862705fc 41 \param buffer The buffer for storing the incoming packet data. If a packet
mfiore 9:b2e3862705fc 42 is too long to fit in the supplied buffer, excess bytes are discarded
mfiore 9:b2e3862705fc 43 \param length The length of the buffer
mfiore 9:b2e3862705fc 44 \return the number of received bytes on success (>=0) or -1 on failure
mfiore 9:b2e3862705fc 45 */
mfiore 9:b2e3862705fc 46 int receiveFrom(Endpoint &remote, char *buffer, int length);
mfiore 9:b2e3862705fc 47 };
mfiore 9:b2e3862705fc 48
Mike Fiore 1:096f484f3ae6 49 #endif