uiil
Dependencies: EthernetInterface mbed-rtos mbed
main.cpp
- Committer:
- aookami
- Date:
- 2017-12-13
- Revision:
- 0:55870e460ef6
File content as of revision 0:55870e460ef6:
#include "mbed.h" #include "rtos.h" #include "EthernetInterface.h" char* ip ="169.254.158.31"; char* mask = "255.255.0.0"; char* gate = NULL; Serial pc(USBTX, USBRX); int main() { pc.printf("lmao1"); EthernetInterface eth1; pc.printf("lmao2"); int errorconnect = -1; eth1.init(); pc.printf("IP Address is %s\n", eth1.getIPAddress()); while(errorconnect == -1){ errorconnect = eth1.connect(3000); pc.printf("\n\nCONNECT COM RESPOSTA:%d",errorconnect); } TCPSocketConnection sock; pc.printf("lmao5"); int errch; errch = sock.connect(ip, 5050); pc.printf("conectou no socket com mensagem %d", errch); char buffer[300]; int ret; while (true) { ret = sock.receive(buffer, sizeof(buffer)-1); if (ret <= 0) break; buffer[ret] = '\0'; pc.printf("Received %d chars from server:\n%s\n", ret, buffer); } sock.close(); eth1.disconnect(); while(1) {} }