int WiFiClient1::connect(IPAddress ip, uint16_t port) { int ret; _sock = getFirstSocket(); if (_sock != SOCK_NOT_AVAIL) { ret = _pTcpSocket->connect(ip.get_address(), port); if ( ret != 0 ) { Serial.print("WiFiClient1 : connect failed ret="); Serial.println(ret); return 0; // socket connect failed. } if (!connected()) { Serial.println("WiFiClient1 : connect failed : connected is not true"); return 0; } _sock = _pTcpSocket->get_socket_fd(); WiFiClass1::_state[_sock] = _sock; _readchar_set = false; } else{ Serial.println("No Socket available"); return 0; } return 1; }
void InitWiFi() { Screen.print("WiFi \r\n \r\nConnecting...\r\n \r\n"); if(WiFi.begin() == WL_CONNECTED) { IPAddress ip = WiFi.localIP(); sprintf(wifiBuff, "WiFi \r\n %s\r\n %s \r\n \r\n",WiFi.SSID(),ip.get_address()); Screen.print(wifiBuff); } else { sprintf(wifiBuff, "WiFi \r\n \r\nNo connection\r\n \r\n"); Screen.print(wifiBuff); } }