LeweiTcpClient::LeweiTcpClient(const char *userKey,const char *gatewayNo): server(EthernetServer(80)), tcpServer("tcp.lewei50.com") { _userKey = (char*)malloc( strlen(userKey)+1 ); strcpy( _userKey,userKey ); _gatewayNo = (char*)malloc( strlen(gatewayNo)+1 ); strcpy( _gatewayNo,gatewayNo ); setupDefaultValue(); //Ethernet.begin(_mac); byte _mac[] = {0x74, 0x69, 0x69, 0x2D, 0x30, 0x31}; if (Ethernet.begin(_mac) == 0) { Serial.println("fail"); // no point in carrying on, so do nothing forevermore: for (;;) ; } Serial.println(Ethernet.localIP()); //Ethernet.begin(mac, ip); delay(1000); String clientStr=""; keepOnline(); }
LeweiTcpClient::LeweiTcpClient(const char *userKey,const char *gatewayNo) { _userKey = userKey; _gatewayNo = gatewayNo; setupDefaultValue(); keepOnline(); }
LeweiTcpClient::LeweiTcpClient( const char *userKey,const char *gatewayNo,byte mac[],IPAddress ip,IPAddress dns,IPAddress gw,IPAddress subnet) { _userKey = userKey; _gatewayNo = gatewayNo; setupDefaultValue(); Ethernet.begin(mac,ip,dns,gw,subnet); Serial.println(Ethernet.localIP()); delay(1000); String clientStr=""; keepOnline(); }
LeweiTcpClient::LeweiTcpClient(const char *userKey,const char *gatewayNo,byte mac[]) { _userKey = userKey; _gatewayNo = gatewayNo; setupDefaultValue(); Ethernet.begin(mac); Serial.println(Ethernet.localIP()); delay(1000); String clientStr=""; keepOnline(); }
LeweiTcpClient::LeweiTcpClient( const char *userKey,const char *gatewayNo,byte mac[],IPAddress ip,IPAddress dns,IPAddress gw,IPAddress subnet): server(EthernetServer(80)), tcpServer("tcp.lewei50.com") { _userKey = (char*)malloc( strlen(userKey)+1 ); strcpy( _userKey,userKey ); _gatewayNo = (char*)malloc( strlen(gatewayNo)+1 ); strcpy( _gatewayNo,gatewayNo ); setupDefaultValue(); Ethernet.begin(mac,ip,dns,gw,subnet); Serial.println(Ethernet.localIP()); delay(1000); String clientStr=""; keepOnline(); }
LeweiTcpClient::LeweiTcpClient(const char *userKey,const char *gatewayNo) { _userKey = userKey; _gatewayNo = gatewayNo; setupDefaultValue(); //IPAddress tcpServer(42,121,128,216); //tcp.lewei50.com's ip //IPAddress uploadServer(42,121,128,216);// "open.lewei50.com"; Ethernet.begin(_mac); Serial.println(Ethernet.localIP()); //Ethernet.begin(mac, ip); delay(1000); String clientStr=""; //_postInterval = 5000; //_starttime = millis(); keepOnline(); }