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.
Fork of Socket by
Diff: UDPSocket.h
- Revision:
- 11:3d83c348fb8b
- Parent:
- 10:d24738f4ef99
- Child:
- 16:2d471deff212
diff -r d24738f4ef99 -r 3d83c348fb8b UDPSocket.h
--- a/UDPSocket.h Tue Jul 31 11:50:55 2012 +0000
+++ b/UDPSocket.h Wed Aug 01 13:02:32 2012 +0000
@@ -20,7 +20,8 @@
#define UDPSOCKET_H
#include "Socket/Socket.h"
-#include "Socket/UDPPacket.h"
+#include "Socket/Endpoint.h"
+
#include <cstdint>
/**
@@ -33,8 +34,6 @@
*/
UDPSocket();
- ~UDPSocket();
-
/** Init the UDP Client Socket without binding it to any specific port
\return 0 on success, -1 on failure.
*/
@@ -46,19 +45,22 @@
*/
int bind(int port);
- /** Send a packet to the remote host.
- \param packet UDP Packet to be sent to the remote host
+ /** Send a packet to a remote endpoint
+ \param remote The remote endpoint
+ \param packet The packet to be sent
+ \param length The length of the packet to be sent
\return the number of written bytes on success (>=0) or -1 on failure
*/
- int sendTo(UDPPacket& packet);
+ int sendTo(Endpoint &remote, char *packet, int length);
- /** Receive data from a remote host.
- If a message is too long to fit in the supplied packet, excess bytes are
- discarded.
- \param packet UDP Packet received from the remote host
+ /** Receive a packet from a remote endpoint
+ \param remote The remote endpoint
+ \param buffer The buffer for storing the incoming packet data. If a packet
+ is too long to fit in the supplied buffer, excess bytes are discarded
+ \param length The length of the buffer
\return the number of received bytes on success (>=0) or -1 on failure
*/
- int receiveFrom(UDPPacket& packet);
+ int receiveFrom(Endpoint &remote, char *buffer, int length);
};
-#endif
+#endif
