summaryrefslogtreecommitdiffstats
path: root/src/device/device_network.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/device/device_network.cpp')
-rw-r--r--src/device/device_network.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/device/device_network.cpp b/src/device/device_network.cpp
index d7781a0..f2456d9 100644
--- a/src/device/device_network.cpp
+++ b/src/device/device_network.cpp
@@ -26,7 +26,7 @@
static struct netstate {
WiFiUDP udp;
- char udppacketbuffer[1500];
+ char udppacketbuffer[MTU];
char *udppacketcursor;
IPAddress daemon_ip;
bool acquired;
@@ -59,6 +59,17 @@ int udp_flush(void)
return state.udp.endPacket();
}
+size_t udp_get_data(char *buf, size_t size)
+{
+ size_t ret;
+ if (state.udp.available() != 0) {
+ ret = state.udp.read(buf, size);
+ } else {
+ ret = 0;
+ }
+ return ret;
+}
+
void discover_client(const int port)
{
IPAddress bcastip(255, 255, 255, 255);
@@ -100,4 +111,3 @@ static void udp_init_packet_expaddr(IPAddress ip, const int port)
memset(state.udppacketbuffer, 0, sizeof(state.udppacketbuffer));
state.udppacketcursor = state.udppacketbuffer;
}
-