简体   繁体   English

TCP封包中的禁止字元

[英]Forbidden characters in a TCP packet

I'm trying to send data from my ESP8266 to a NodeJS TCP server, the connection and basic charakters (48-90) are working fine, but if I use others like ASCII-Code (0,1,2,3...) I don't get any usefull data out of it. 我正在尝试将数据从ESP8266发送到NodeJS TCP服务器,连接和基本字符(48-90)都可以正常工作,但是如果我使用ASCII码(0,1,2,3 ... )我没有得到任何有用的数据。 So what I was thinking about that there are some character which aren't allowed to send over TCP/IP. 所以我在想的是有些字符不允许通过TCP / IP发送。

By the way, I'm using this to write to the server, and I work with the standard WiFi Client library 顺便说一句,我正在使用它来写入服务器,并且可以使用标准的WiFi客户端库

char arr[255]
for(int i = 0; i < 255; i++){
   arr[i] = (char)i;
}
client.print(arr);

On the TCP/IP level, any characters values can be sent. 在TCP / IP级别上,可以发送任何字符值。 The protocol is often used to transfer binary data (eg SSH, FTP etc. do this). 该协议通常用于传输二进制数据(例如SSH,FTP等)。

The problem is likely to be in your code adding the characters to the sent data or printing the received string. 问题可能出在您的代码中,这些字符将字符添加到发送的数据或打印接收的字符串。

One thing you can do to determine if the problem is on the sending or receiving side is to use Wireshark on your server machine to capture the transmitted data and check if the bytes are actually sent or not. 要确定问题是在发送端还是在接收端,您可以做的一件事是在服务器计算机上使用Wireshark捕获传输的数据,并检查字节是否实际发送。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM