TCP-Server-sample

Committer:
YSI
Date:
Thu Apr 08 12:45:42 2021 +0000
Revision:
1:263b4d8f37b9
Parent:
0:d3cd3a4b962c
delete unused serial

Who changed what in which revision?

UserRevisionLine numberNew contents of line
YSI 0:d3cd3a4b962c 1 #ifndef MAIN_H
YSI 0:d3cd3a4b962c 2 #define MAIN_H
YSI 0:d3cd3a4b962c 3
YSI 0:d3cd3a4b962c 4 #define MBED_PROJECT "TCP-sample"
YSI 0:d3cd3a4b962c 5 #define IP_SERVER "192.168.1.25"
YSI 0:d3cd3a4b962c 6 #define PORT_SERVER 80
YSI 0:d3cd3a4b962c 7 #define TIMEOUT_SERVER 100
YSI 0:d3cd3a4b962c 8 #define BUFFER_SIZE 1072
YSI 0:d3cd3a4b962c 9
YSI 0:d3cd3a4b962c 10 #include "mbed.h"
YSI 0:d3cd3a4b962c 11 #include "EthernetInterface.h"
YSI 0:d3cd3a4b962c 12 #include <sstream>
YSI 0:d3cd3a4b962c 13
YSI 0:d3cd3a4b962c 14 EthernetInterface eth;
YSI 0:d3cd3a4b962c 15 TCPSocket serverTCP, *clientTCP;
YSI 0:d3cd3a4b962c 16 EventQueue *queue = NULL;
YSI 0:d3cd3a4b962c 17 BusOut Led(LED1, LED2, LED3);
YSI 0:d3cd3a4b962c 18
YSI 0:d3cd3a4b962c 19 bool CONNECT = false;
YSI 0:d3cd3a4b962c 20
YSI 0:d3cd3a4b962c 21 enum enum_status { WHITE, CYAN, MAGENTA_ACCEPT, BLUE_CLIENT, YELLOW_CONNECTING, GREEN_GLOBAL_UP, RED_DISCONNECTED, BLACK_INITIALIZE }
YSI 0:d3cd3a4b962c 22 eth_status = RED_DISCONNECTED;
YSI 0:d3cd3a4b962c 23
YSI 0:d3cd3a4b962c 24 bool eth_connect(void);
YSI 0:d3cd3a4b962c 25 void eth_event(nsapi_event_t, intptr_t);
YSI 0:d3cd3a4b962c 26 void eth_state(void);
YSI 0:d3cd3a4b962c 27
YSI 0:d3cd3a4b962c 28 bool serverTCP_connect(void);
YSI 0:d3cd3a4b962c 29 void serverTCP_event(void);
YSI 0:d3cd3a4b962c 30 void serverTCP_accept(void);
YSI 0:d3cd3a4b962c 31
YSI 0:d3cd3a4b962c 32 enum_status recv(void);
YSI 0:d3cd3a4b962c 33 nsapi_error_t send(const string& buff);
YSI 0:d3cd3a4b962c 34 #endif