multiplayer pong game for LPC 1768

Dependencies:   mbed MbedJSONValue mbed-rtos Adafruit_ST7735 Adafruit_GFX EthernetInterface DebouncedInterrupt

Revision:
17:32ae1f106002
Parent:
15:9d90f68e53da
Child:
19:58cc5465f647
--- a/network.cpp	Fri Nov 13 23:02:56 2020 +0000
+++ b/network.cpp	Sat Nov 14 02:37:13 2020 +0000
@@ -1,12 +1,29 @@
 #include "network.h"
 
 void initEthernet(EthernetInterface *eth, UDPSocket *sock, Endpoint *nist) {
-    eth->init(); //Use DHCP
-    eth->connect();
-    sock->init();
-    nist->set_address(AWS_IP, PORT);
+    int rc; 
+    rc = eth->init(); //Use DHCP
+    if (rc < 0) {
+        printf("Fatal Error: failed to initialize ethernet via DHCP\n\r");
+        return; 
+    }
+    rc = eth->connect();
+    if (rc < 0) {
+        printf("Fatal Error: failed to connect\n\r");
+        return; 
+    }
+    rc = sock->init();
+    if (rc < 0) {
+        printf("Fatal Error: failed to initialize socket\n\r");
+        return; 
+    }
+    rc = nist->set_address(AWS_IP, PORT);
+    if (rc < 0) {
+        printf("Fatal Error: failed to set address\n\r");
+        return; 
+    }
     sock->set_blocking(false, 0);
-    printf("Connected to %s, port: %i\n\r", AWS_IP, PORT); 
+    printf("Success! Connected to %s, port: %i\n\r", AWS_IP, PORT); 
 }
 
 void cleanupEthernet(EthernetInterface *eth, UDPSocket *sock) {