






Started logging.

<<<
Content-Length: 3246

{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":17896,"clientInfo":{"name":"vscode","version":"1.50.0"},"rootPath":"c:\\Users\\zhang'pei\\Desktop\\ESP32-2432S028例子\\arduino\\Source code\\4_5_WIFI_STA_TCP_Client","rootUri":"file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_5_WIFI_STA_TCP_Client","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional"},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"tagSupport":{"valueSet":[1,2]}},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true,"tagSupport":{"valueSet":[1]}},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true}},"contextSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true},"codeAction":{"dynamicRegistration":true,"isPreferredSupport":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"declaration":{"dynamicRegistration":true,"linkSupport":true},"selectionRange":{"dynamicRegistration":true}},"window":{"workDoneProgress":true}},"initializationOptions":{},"trace":"off","workspaceFolders":[{"uri":"file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_5_WIFI_STA_TCP_Client","name":"4_5_WIFI_STA_TCP_Client"}]}}
>>>
Content-Length: 598

{"id":0,"result":{"capabilities":{"textDocumentSync":2,"hoverProvider":true,"completionProvider":{"triggerCharacters":[".","\u003e",":"]},"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"codeActionProvider":true,"documentFormattingProvider":true,"documentRangeFormattingProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"\n"},"renameProvider":false,"executeCommandProvider":{"commands":["clangd.applyFix","clangd.applyTweak"]}}},"jsonrpc":"2.0"}
<<<
Content-Length: 52

{"jsonrpc":"2.0","method":"initialized","params":{}}Content-Length: 2101

{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_5_WIFI_STA_TCP_Client/4_5_WIFI_STA_TCP_Client.ino","languageId":"cpp","version":1,"text":"#include <WiFi.h>\r\n\r\nconst char *ssid = \"CMCC-404\";\r\nconst char *password = \"zp198612\";\r\n\r\nconst IPAddress serverIP(192,168,0,122); //欲访问的地址\r\nuint16_t serverPort = 8080;         //服务器端口号\r\n\r\nWiFiClient client; //声明一个客户端对象，用于与服务器进行连接\r\n\r\nvoid setup()\r\n{\r\n    Serial.begin(115200);\r\n    Serial.println();\r\n\r\n    WiFi.mode(WIFI_STA);\r\n    WiFi.setSleep(false); //关闭STA模式下wifi休眠，提高响应速度\r\n    WiFi.begin(ssid, password);\r\n    while (WiFi.status() != WL_CONNECTED)\r\n    {\r\n        delay(500);\r\n        Serial.print(\".\");\r\n    }\r\n    Serial.println(\"Connected\");\r\n    Serial.print(\"IP Address:\");\r\n    Serial.println(WiFi.localIP());\r\n}\r\n\r\nvoid loop()\r\n{\r\n    Serial.println(\"尝试访问服务器\");\r\n    if (client.connect(serverIP, serverPort)) //尝试访问目标地址\r\n    {\r\n        Serial.println(\"访问成功\");\r\n\r\n        client.print(\"Hello world!\");                    //向服务器发送数据\r\n        while (client.connected() || client.available()) //如果已连接或有收到的未读取的数据\r\n        {\r\n            if (client.available()) //如果有数据可读取\r\n            {\r\n                String line = client.readStringUntil('\\n'); //读取数据到换行符\r\n                Serial.print(\"读取到数据：\");\r\n                Serial.println(line);\r\n                client.write(line.c_str()); //将收到的数据回发\r\n            }\r\n        }\r\n        Serial.println(\"关闭当前连接\");\r\n        client.stop(); //关闭客户端\r\n    }\r\n    else\r\n    {\r\n        Serial.println(\"访问失败\");\r\n        client.stop(); //关闭客户端\r\n    }\r\n    delay(5000);\r\n}\r\n"}}}






Started logging.

<<<
Content-Length: 3245

{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":2448,"clientInfo":{"name":"vscode","version":"1.50.0"},"rootPath":"c:\\Users\\zhang'pei\\Desktop\\ESP32-2432S028例子\\arduino\\Source code\\4_5_WIFI_STA_TCP_Client","rootUri":"file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_5_WIFI_STA_TCP_Client","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional"},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"tagSupport":{"valueSet":[1,2]}},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true,"tagSupport":{"valueSet":[1]}},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true}},"contextSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true},"codeAction":{"dynamicRegistration":true,"isPreferredSupport":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"declaration":{"dynamicRegistration":true,"linkSupport":true},"selectionRange":{"dynamicRegistration":true}},"window":{"workDoneProgress":true}},"initializationOptions":{},"trace":"off","workspaceFolders":[{"uri":"file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_5_WIFI_STA_TCP_Client","name":"4_5_WIFI_STA_TCP_Client"}]}}
>>>
Content-Length: 598

{"id":0,"result":{"capabilities":{"textDocumentSync":2,"hoverProvider":true,"completionProvider":{"triggerCharacters":[".","\u003e",":"]},"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"codeActionProvider":true,"documentFormattingProvider":true,"documentRangeFormattingProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"\n"},"renameProvider":false,"executeCommandProvider":{"commands":["clangd.applyFix","clangd.applyTweak"]}}},"jsonrpc":"2.0"}
<<<
Content-Length: 52

{"jsonrpc":"2.0","method":"initialized","params":{}}Content-Length: 2101

{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_5_WIFI_STA_TCP_Client/4_5_WIFI_STA_TCP_Client.ino","languageId":"cpp","version":1,"text":"#include <WiFi.h>\r\n\r\nconst char *ssid = \"CMCC-404\";\r\nconst char *password = \"12345678\";\r\n\r\nconst IPAddress serverIP(192,168,0,122); //欲访问的地址\r\nuint16_t serverPort = 8080;         //服务器端口号\r\n\r\nWiFiClient client; //声明一个客户端对象，用于与服务器进行连接\r\n\r\nvoid setup()\r\n{\r\n    Serial.begin(115200);\r\n    Serial.println();\r\n\r\n    WiFi.mode(WIFI_STA);\r\n    WiFi.setSleep(false); //关闭STA模式下wifi休眠，提高响应速度\r\n    WiFi.begin(ssid, password);\r\n    while (WiFi.status() != WL_CONNECTED)\r\n    {\r\n        delay(500);\r\n        Serial.print(\".\");\r\n    }\r\n    Serial.println(\"Connected\");\r\n    Serial.print(\"IP Address:\");\r\n    Serial.println(WiFi.localIP());\r\n}\r\n\r\nvoid loop()\r\n{\r\n    Serial.println(\"尝试访问服务器\");\r\n    if (client.connect(serverIP, serverPort)) //尝试访问目标地址\r\n    {\r\n        Serial.println(\"访问成功\");\r\n\r\n        client.print(\"Hello world!\");                    //向服务器发送数据\r\n        while (client.connected() || client.available()) //如果已连接或有收到的未读取的数据\r\n        {\r\n            if (client.available()) //如果有数据可读取\r\n            {\r\n                String line = client.readStringUntil('\\n'); //读取数据到换行符\r\n                Serial.print(\"读取到数据：\");\r\n                Serial.println(line);\r\n                client.write(line.c_str()); //将收到的数据回发\r\n            }\r\n        }\r\n        Serial.println(\"关闭当前连接\");\r\n        client.stop(); //关闭客户端\r\n    }\r\n    else\r\n    {\r\n        Serial.println(\"访问失败\");\r\n        client.stop(); //关闭客户端\r\n    }\r\n    delay(5000);\r\n}\r\n"}}}