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 ELEC351 by
Diff: NETWORK.cpp
- Revision:
- 37:7c4d7f206039
- Parent:
- 36:a0098306fc58
- Child:
- 41:859b5e1e3d9a
--- a/NETWORK.cpp Sun Jan 07 16:17:24 2018 +0000
+++ b/NETWORK.cpp Sun Jan 07 19:21:11 2018 +0000
@@ -1,14 +1,14 @@
#include "NETWORK.hpp"
-
+#include <string>
AnalogIn ldr(PA_0);
//Now setup a web server
TCPServer srv; //TCP/IP Server
TCPSocket clt_sock; //Socket for communication
SocketAddress clt_addr; //Address of incoming connection
-
+string GateWay_IP;
-void Network_Init()
+int Network_Init()
{
printf("Basic HTTP server example\n");
//Configure an ethernet connection
@@ -16,7 +16,13 @@
eth.set_network(IP, NETMASK, GATEWAY);
eth.connect();
printf("The target IP address is '%s'\n", eth.get_ip_address());
- //t1.start(Network_Thread);
+ GateWay_IP = eth.get_ip_address();
+
+ if(GateWay_IP != "10.0.0.10")
+ {
+ return 1;
+ //Error code here
+ }
/* Open the server on ethernet stack */
srv.open(ð);
@@ -25,6 +31,7 @@
/* Can handle 5 simultaneous connections */
srv.listen(5);
+ return 0;
}
void Networking(int network_day, int network_month, int network_year, int network_hours, int network_minute, float network_temperature, float network_pressure, float network_light)
{
