mirror of
https://github.com/lsdlsd88/JC4827W543.git
synced 2026-07-21 11:24:01 +01:00
initial commit
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
#include <WiFi.h>
|
||||
|
||||
const char *ssid = "CMCC-404";
|
||||
const char *password = "12345678";
|
||||
|
||||
WiFiServer server; //声明服务器对象
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println();
|
||||
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.setSleep(false); //关闭STA模式下wifi休眠,提高响应速度
|
||||
WiFi.begin(ssid, password);
|
||||
while (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
delay(500);
|
||||
Serial.print(".");
|
||||
}
|
||||
Serial.println("Connected");
|
||||
Serial.print("IP Address:");
|
||||
Serial.println(WiFi.localIP());
|
||||
|
||||
server.begin(10000); //服务器启动监听端口号22333
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
WiFiClient client = server.available(); //尝试建立客户对象
|
||||
if (client) //如果当前客户可用
|
||||
{
|
||||
Serial.println("[Client connected]");
|
||||
String readBuff;
|
||||
while (client.connected()) //如果客户端处于连接状态
|
||||
{
|
||||
if (client.available()) //如果有可读数据
|
||||
{
|
||||
char c = client.read(); //读取一个字节
|
||||
//也可以用readLine()等其他方法
|
||||
readBuff += c;
|
||||
if(c == '\r') //接收到回车符
|
||||
{
|
||||
client.print("Received: " + readBuff); //向客户端发送
|
||||
Serial.println("Received: " + readBuff); //从串口打印
|
||||
readBuff = "";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
client.stop(); //结束当前连接:
|
||||
Serial.println("[Client disconnected]");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Started logging.
|
||||
2022/06/26 18:20:47 logging to c:\Users\zhang'pei\Desktop\ESP32-2432S028例子\arduino\Source code\4_4_wifi_STA_TCP_Server\inols.log
|
||||
2022/06/26 18:20:47 Initial board configuration: {"ESP32 Dev Module" esp32:esp32:esp32}
|
||||
2022/06/26 18:20:47 Language server build path: C:\Users\zhang'pei\AppData\Local\Temp\arduino-language-server565690311
|
||||
2022/06/26 18:20:47 Language server build sketch root: C:\Users\zhang'pei\AppData\Local\Temp\arduino-language-server565690311\sketch
|
||||
2022/06/26 18:20:47 [92mIDE --> LS CL: REQUEST initialize 0: [0m
|
||||
2022/06/26 18:20:47 IDE --> initialize 0 [93m locked[0m
|
||||
2022/06/26 18:20:47 IDE --> initialize 0 [93m unlocked[0m
|
||||
2022/06/26 18:20:47 INIT--- initializing workbench
|
||||
2022/06/26 18:20:47 INIT--- [93m locked[0m
|
||||
2022/06/26 18:20:47 --> initialize(file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_4_wifi_STA_TCP_Server)
|
||||
2022/06/26 18:20:47 [91mIDE <-- LS CL: ANSWER UNBOUND (0): [0m
|
||||
2022/06/26 18:20:47 running: d:\arduino\Arduino IDE\resources\app\node_modules\arduino-ide-extension\build\arduino-cli.exe --config-file c:\Users\zhang'pei\.arduinoIDE\arduino-cli.yaml compile --fqbn esp32:esp32:esp32 --only-compilation-database --clean --source-override C:\Users\ZHANG'~1\AppData\Local\Temp\732217466 --build-path C:\Users\zhang'pei\AppData\Local\Temp\arduino-language-server565690311 --format json C:\Users\zhang'pei\Desktop\ESP32-2432S028例子\arduino\Source code\4_4_wifi_STA_TCP_Server
|
||||
2022/06/26 18:20:47 [92mIDE --> LS CL: NOTIFICATION initialized: [0m
|
||||
2022/06/26 18:20:49 INIT--- initializing workbench (done)
|
||||
2022/06/26 18:20:49 INIT--- [93m unlocked[0m
|
||||
2022/06/26 18:20:49 IDE --> initialized notif1 [93m read-locked[0m
|
||||
2022/06/26 18:20:49 IDE --> initialized notif1 notification is not propagated to clangd
|
||||
2022/06/26 18:20:49 IDE --> initialized notif1 [93m read-unlocked[0m
|
||||
2022/06/26 18:20:49 [92mIDE --> LS CL: NOTIFICATION textDocument/didOpen: [0m
|
||||
2022/06/26 18:20:49 IDE --> textDocument/didOpen notif2 [93m locked[0m
|
||||
2022/06/26 18:20:49 IDE --> textDocument/didOpen notif2 (throttled: waiting for clangd)
|
||||
2022/06/26 18:20:49 IDE --> textDocument/didOpen notif2 [93m unlocked (waiting clangd)[0m
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Started logging.
|
||||
2022/06/27 11:23:55 logging to c:\Users\zhang'pei\Desktop\ESP32-2432S028例子\arduino\Source code\4_4_wifi_STA_TCP_Server\inols.log
|
||||
2022/06/27 11:23:55 Initial board configuration: {"ESP32 Dev Module" esp32:esp32:esp32}
|
||||
2022/06/27 11:23:55 Language server build path: C:\Users\zhang'pei\AppData\Local\Temp\arduino-language-server889275795
|
||||
2022/06/27 11:23:55 Language server build sketch root: C:\Users\zhang'pei\AppData\Local\Temp\arduino-language-server889275795\sketch
|
||||
2022/06/27 11:23:55 [92mIDE --> LS CL: REQUEST initialize 0: [0m
|
||||
2022/06/27 11:23:55 IDE --> initialize 0 [93m locked[0m
|
||||
2022/06/27 11:23:55 IDE --> initialize 0 [93m unlocked[0m
|
||||
2022/06/27 11:23:55 INIT--- initializing workbench
|
||||
2022/06/27 11:23:55 INIT--- [93m locked[0m
|
||||
2022/06/27 11:23:55 [91mIDE <-- LS CL: ANSWER UNBOUND (0): [0m
|
||||
2022/06/27 11:23:55 --> initialize(file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_4_wifi_STA_TCP_Server)
|
||||
2022/06/27 11:23:55 running: d:\arduino\Arduino IDE\resources\app\node_modules\arduino-ide-extension\build\arduino-cli.exe --config-file c:\Users\zhang'pei\.arduinoIDE\arduino-cli.yaml compile --fqbn esp32:esp32:esp32 --only-compilation-database --clean --source-override C:\Users\ZHANG'~1\AppData\Local\Temp\817216470 --build-path C:\Users\zhang'pei\AppData\Local\Temp\arduino-language-server889275795 --format json C:\Users\zhang'pei\Desktop\ESP32-2432S028例子\arduino\Source code\4_4_wifi_STA_TCP_Server
|
||||
2022/06/27 11:23:55 [92mIDE --> LS CL: NOTIFICATION initialized: [0m
|
||||
2022/06/27 11:23:56 INIT--- initializing workbench (done)
|
||||
2022/06/27 11:23:56 INIT--- [93m unlocked[0m
|
||||
2022/06/27 11:23:56 IDE --> initialized notif1 [93m read-locked[0m
|
||||
2022/06/27 11:23:56 IDE --> initialized notif1 notification is not propagated to clangd
|
||||
2022/06/27 11:23:56 IDE --> initialized notif1 [93m read-unlocked[0m
|
||||
2022/06/27 11:23:56 [92mIDE --> LS CL: NOTIFICATION textDocument/didOpen: [0m
|
||||
2022/06/27 11:23:56 IDE --> textDocument/didOpen notif2 [93m locked[0m
|
||||
2022/06/27 11:23:56 IDE --> textDocument/didOpen notif2 (throttled: waiting for clangd)
|
||||
2022/06/27 11:23:56 IDE --> textDocument/didOpen notif2 [93m unlocked (waiting clangd)[0m
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Started logging.
|
||||
2022/06/27 11:24:43 logging to c:\Users\zhang'pei\Desktop\ESP32-2432S028例子\arduino\Source code\4_4_wifi_STA_TCP_Server\inols.log
|
||||
2022/06/27 11:24:43 Initial board configuration: {"ESP32 Dev Module" esp32:esp32:esp32}
|
||||
2022/06/27 11:24:43 Language server build path: C:\Users\zhang'pei\AppData\Local\Temp\arduino-language-server070346511
|
||||
2022/06/27 11:24:43 Language server build sketch root: C:\Users\zhang'pei\AppData\Local\Temp\arduino-language-server070346511\sketch
|
||||
2022/06/27 11:24:43 [92mIDE --> LS CL: REQUEST initialize 0: [0m
|
||||
2022/06/27 11:24:43 IDE --> initialize 0 [93m locked[0m
|
||||
2022/06/27 11:24:43 IDE --> initialize 0 [93m unlocked[0m
|
||||
2022/06/27 11:24:43 INIT--- initializing workbench
|
||||
2022/06/27 11:24:43 INIT--- [93m locked[0m
|
||||
2022/06/27 11:24:43 --> initialize(file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_4_wifi_STA_TCP_Server)
|
||||
2022/06/27 11:24:43 [91mIDE <-- LS CL: ANSWER UNBOUND (0): [0m
|
||||
2022/06/27 11:24:43 running: d:\arduino\Arduino IDE\resources\app\node_modules\arduino-ide-extension\build\arduino-cli.exe --config-file c:\Users\zhang'pei\.arduinoIDE\arduino-cli.yaml compile --fqbn esp32:esp32:esp32 --only-compilation-database --clean --source-override C:\Users\ZHANG'~1\AppData\Local\Temp\220769570 --build-path C:\Users\zhang'pei\AppData\Local\Temp\arduino-language-server070346511 --format json C:\Users\zhang'pei\Desktop\ESP32-2432S028例子\arduino\Source code\4_4_wifi_STA_TCP_Server
|
||||
2022/06/27 11:24:43 [92mIDE --> LS CL: NOTIFICATION initialized: [0m
|
||||
2022/06/27 11:24:44 INIT--- initializing workbench (done)
|
||||
2022/06/27 11:24:44 INIT--- [93m unlocked[0m
|
||||
2022/06/27 11:24:44 IDE --> initialized notif1 [93m read-locked[0m
|
||||
2022/06/27 11:24:44 IDE --> initialized notif1 notification is not propagated to clangd
|
||||
2022/06/27 11:24:44 IDE --> initialized notif1 [93m read-unlocked[0m
|
||||
2022/06/27 11:24:44 [92mIDE --> LS CL: NOTIFICATION textDocument/didOpen: [0m
|
||||
2022/06/27 11:24:44 IDE --> textDocument/didOpen notif2 [93m locked[0m
|
||||
2022/06/27 11:24:44 IDE --> textDocument/didOpen notif2 (throttled: waiting for clangd)
|
||||
2022/06/27 11:24:44 IDE --> textDocument/didOpen notif2 [93m unlocked (waiting clangd)[0m
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Started logging.
|
||||
2022/06/27 12:34:58 logging to c:\Users\zhang'pei\Desktop\ESP32-2432S028例子\arduino\Source code\4_4_wifi_STA_TCP_Server\inols.log
|
||||
2022/06/27 12:34:58 Initial board configuration: {"ESP32 Dev Module" esp32:esp32:esp32}
|
||||
2022/06/27 12:34:58 Language server build path: C:\Users\zhang'pei\AppData\Local\Temp\arduino-language-server000923903
|
||||
2022/06/27 12:34:58 Language server build sketch root: C:\Users\zhang'pei\AppData\Local\Temp\arduino-language-server000923903\sketch
|
||||
2022/06/27 12:34:58 [92mIDE --> LS CL: REQUEST initialize 0: [0m
|
||||
2022/06/27 12:34:58 IDE --> initialize 0 [93m locked[0m
|
||||
2022/06/27 12:34:58 IDE --> initialize 0 [93m unlocked[0m
|
||||
2022/06/27 12:34:58 INIT--- initializing workbench
|
||||
2022/06/27 12:34:58 INIT--- [93m locked[0m
|
||||
2022/06/27 12:34:58 [91mIDE <-- LS CL: ANSWER UNBOUND (0): [0m
|
||||
2022/06/27 12:34:58 --> initialize(file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_4_wifi_STA_TCP_Server)
|
||||
2022/06/27 12:34:58 running: d:\arduino\Arduino IDE\resources\app\node_modules\arduino-ide-extension\build\arduino-cli.exe --config-file c:\Users\zhang'pei\.arduinoIDE\arduino-cli.yaml compile --fqbn esp32:esp32:esp32 --only-compilation-database --clean --source-override C:\Users\ZHANG'~1\AppData\Local\Temp\483787858 --build-path C:\Users\zhang'pei\AppData\Local\Temp\arduino-language-server000923903 --format json C:\Users\zhang'pei\Desktop\ESP32-2432S028例子\arduino\Source code\4_4_wifi_STA_TCP_Server
|
||||
2022/06/27 12:34:58 [92mIDE --> LS CL: NOTIFICATION initialized: [0m
|
||||
2022/06/27 12:34:59 INIT--- initializing workbench (done)
|
||||
2022/06/27 12:34:59 INIT--- [93m unlocked[0m
|
||||
2022/06/27 12:34:59 IDE --> initialized notif1 [93m read-locked[0m
|
||||
2022/06/27 12:34:59 IDE --> initialized notif1 notification is not propagated to clangd
|
||||
2022/06/27 12:34:59 IDE --> initialized notif1 [93m read-unlocked[0m
|
||||
2022/06/27 12:34:59 [92mIDE --> LS CL: NOTIFICATION textDocument/didOpen: [0m
|
||||
2022/06/27 12:34:59 IDE --> textDocument/didOpen notif2 [93m locked[0m
|
||||
2022/06/27 12:34:59 IDE --> textDocument/didOpen notif2 (throttled: waiting for clangd)
|
||||
2022/06/27 12:34:59 IDE --> textDocument/didOpen notif2 [93m unlocked (waiting clangd)[0m
|
||||
@@ -0,0 +1,89 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Started logging.
|
||||
|
||||
<<<
|
||||
Content-Length: 3246
|
||||
|
||||
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":16512,"clientInfo":{"name":"vscode","version":"1.50.0"},"rootPath":"c:\\Users\\zhang'pei\\Desktop\\ESP32-2432S028例子\\arduino\\Source code\\4_4_wifi_STA_TCP_Server","rootUri":"file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_4_wifi_STA_TCP_Server","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_4_wifi_STA_TCP_Server","name":"4_4_wifi_STA_TCP_Server"}]}}
|
||||
>>>
|
||||
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: 1991
|
||||
|
||||
{"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_4_wifi_STA_TCP_Server/4_4_wifi_STA_TCP_Server.ino","languageId":"cpp","version":1,"text":"#include <WiFi.h>\r\n\r\nconst char *ssid = \"iphone\";\r\nconst char *password = \"12345678\";\r\n\r\nWiFiServer server; //声明服务器对象\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 server.begin(10000); //服务器启动监听端口号22333\r\n}\r\n\r\nvoid loop()\r\n{\r\n WiFiClient client = server.available(); //尝试建立客户对象\r\n if (client) //如果当前客户可用\r\n {\r\n Serial.println(\"[Client connected]\");\r\n String readBuff;\r\n while (client.connected()) //如果客户端处于连接状态\r\n {\r\n if (client.available()) //如果有可读数据\r\n {\r\n char c = client.read(); //读取一个字节\r\n //也可以用readLine()等其他方法\r\n readBuff += c;\r\n if(c == '\\r') //接收到回车符\r\n {\r\n client.print(\"Received: \" + readBuff); //向客户端发送\r\n Serial.println(\"Received: \" + readBuff); //从串口打印\r\n readBuff = \"\";\r\n\r\n }\r\n }\r\n }\r\n client.stop(); //结束当前连接:\r\n Serial.println(\"[Client disconnected]\");\r\n }\r\n}\r\n"}}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Started logging.
|
||||
|
||||
<<<
|
||||
Content-Length: 3246
|
||||
|
||||
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":17088,"clientInfo":{"name":"vscode","version":"1.50.0"},"rootPath":"c:\\Users\\zhang'pei\\Desktop\\ESP32-2432S028例子\\arduino\\Source code\\4_4_wifi_STA_TCP_Server","rootUri":"file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_4_wifi_STA_TCP_Server","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_4_wifi_STA_TCP_Server","name":"4_4_wifi_STA_TCP_Server"}]}}
|
||||
>>>
|
||||
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: 1993
|
||||
|
||||
{"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_4_wifi_STA_TCP_Server/4_4_wifi_STA_TCP_Server.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\nWiFiServer server; //声明服务器对象\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 server.begin(10000); //服务器启动监听端口号22333\r\n}\r\n\r\nvoid loop()\r\n{\r\n WiFiClient client = server.available(); //尝试建立客户对象\r\n if (client) //如果当前客户可用\r\n {\r\n Serial.println(\"[Client connected]\");\r\n String readBuff;\r\n while (client.connected()) //如果客户端处于连接状态\r\n {\r\n if (client.available()) //如果有可读数据\r\n {\r\n char c = client.read(); //读取一个字节\r\n //也可以用readLine()等其他方法\r\n readBuff += c;\r\n if(c == '\\r') //接收到回车符\r\n {\r\n client.print(\"Received: \" + readBuff); //向客户端发送\r\n Serial.println(\"Received: \" + readBuff); //从串口打印\r\n readBuff = \"\";\r\n\r\n }\r\n }\r\n }\r\n client.stop(); //结束当前连接:\r\n Serial.println(\"[Client disconnected]\");\r\n }\r\n}\r\n"}}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Started logging.
|
||||
|
||||
<<<
|
||||
Content-Length: 3246
|
||||
|
||||
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":16444,"clientInfo":{"name":"vscode","version":"1.50.0"},"rootPath":"c:\\Users\\zhang'pei\\Desktop\\ESP32-2432S028例子\\arduino\\Source code\\4_4_wifi_STA_TCP_Server","rootUri":"file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_4_wifi_STA_TCP_Server","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_4_wifi_STA_TCP_Server","name":"4_4_wifi_STA_TCP_Server"}]}}
|
||||
>>>
|
||||
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: 1993
|
||||
|
||||
{"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_4_wifi_STA_TCP_Server/4_4_wifi_STA_TCP_Server.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\nWiFiServer server; //声明服务器对象\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 server.begin(10000); //服务器启动监听端口号22333\r\n}\r\n\r\nvoid loop()\r\n{\r\n WiFiClient client = server.available(); //尝试建立客户对象\r\n if (client) //如果当前客户可用\r\n {\r\n Serial.println(\"[Client connected]\");\r\n String readBuff;\r\n while (client.connected()) //如果客户端处于连接状态\r\n {\r\n if (client.available()) //如果有可读数据\r\n {\r\n char c = client.read(); //读取一个字节\r\n //也可以用readLine()等其他方法\r\n readBuff += c;\r\n if(c == '\\r') //接收到回车符\r\n {\r\n client.print(\"Received: \" + readBuff); //向客户端发送\r\n Serial.println(\"Received: \" + readBuff); //从串口打印\r\n readBuff = \"\";\r\n\r\n }\r\n }\r\n }\r\n client.stop(); //结束当前连接:\r\n Serial.println(\"[Client disconnected]\");\r\n }\r\n}\r\n"}}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Started logging.
|
||||
|
||||
<<<
|
||||
Content-Length: 3246
|
||||
|
||||
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":20416,"clientInfo":{"name":"vscode","version":"1.50.0"},"rootPath":"c:\\Users\\zhang'pei\\Desktop\\ESP32-2432S028例子\\arduino\\Source code\\4_4_wifi_STA_TCP_Server","rootUri":"file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_4_wifi_STA_TCP_Server","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_4_wifi_STA_TCP_Server","name":"4_4_wifi_STA_TCP_Server"}]}}
|
||||
>>>
|
||||
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: 1993
|
||||
|
||||
{"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_4_wifi_STA_TCP_Server/4_4_wifi_STA_TCP_Server.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\nWiFiServer server; //声明服务器对象\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 server.begin(10000); //服务器启动监听端口号22333\r\n}\r\n\r\nvoid loop()\r\n{\r\n WiFiClient client = server.available(); //尝试建立客户对象\r\n if (client) //如果当前客户可用\r\n {\r\n Serial.println(\"[Client connected]\");\r\n String readBuff;\r\n while (client.connected()) //如果客户端处于连接状态\r\n {\r\n if (client.available()) //如果有可读数据\r\n {\r\n char c = client.read(); //读取一个字节\r\n //也可以用readLine()等其他方法\r\n readBuff += c;\r\n if(c == '\\r') //接收到回车符\r\n {\r\n client.print(\"Received: \" + readBuff); //向客户端发送\r\n Serial.println(\"Received: \" + readBuff); //从串口打印\r\n readBuff = \"\";\r\n\r\n }\r\n }\r\n }\r\n client.stop(); //结束当前连接:\r\n Serial.println(\"[Client disconnected]\");\r\n }\r\n}\r\n"}}}
|
||||
Reference in New Issue
Block a user