OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 3520|回复: 1

uIP做TCP客户端出现 got reset, aborting connection等问题的可能原因

[复制链接]

2

主题

4

帖子

0

精华

新手入门

积分
32
金钱
32
注册时间
2015-3-4
在线时间
0 小时
发表于 2015-9-16 16:26:55 | 显示全部楼层 |阅读模式
这几天在用原子的mini+enc28j60+uIP做以太网通信的学习,单片机做客户端,PC端用NodeJS写了服务器,用于打印接收的数据(我本来在服务器上开的3000端口,这就是问题所在)
var net = require('net');
var HOST = '192.168.1.101';
var PORT = 1400;
// Create a server instance, and chain the listen function to it
// The function passed to net.createServer() becomes the event handler for the 'connection' event
// The sock object the callback function receives UNIQUE for each connection
net.createServer(function(sock) {
    // We have a connection - a socket object is assigned to the connection automatically
    console.log('CONNECTED: ' + sock.remoteAddress +':'+ sock.remotePort);
    // Add a 'data' event handler to this instance of socket
    sock.on('data', function(data) {
   console.log('DATA ' + sock.remoteAddress + ': ' + data);
    // Write the data back to the socket, the client will receive it as data from the server
    sock.write('You said "' + data + '"');
    });
    // Add a 'close' event handler to this instance of socket
    sock.on('close', function(data) {
    console.log('CLOSED: ' + sock.remoteAddress +' '+ sock.remotePort);
    });
}).listen(PORT, HOST);
console.log('Server listening on ' + HOST +':'+ PORT);[/mw_shl_code]

结果实验的时候ping/web server/tcp server全无问题,唯独client在服务器端显示连接然后就没有下文



我用wireshark抓包得到
client->server SYN
      <-           SYN,ACK
      ->           ACK
后面用于数据传输的数据包根本就没有出现(显示为PSH,ACK),一段时间后串口输出一个关于ip header length 的问题或者 got reset, aborting connection.事实上在wireshark里没有出现IP报头长度不符合20bytes的数据包,也没有哪一方产生RST
后来死马当活马医,把单片机程序和服务器端口都改成1400



似乎是uIP不支持太大的端口号?顺便求讲解一下具体的原因
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

72

主题

2711

帖子

2

精华

论坛大神

Rank: 7Rank: 7Rank: 7

积分
3505
金钱
3505
注册时间
2014-8-4
在线时间
696 小时
发表于 2015-9-16 23:24:01 | 显示全部楼层
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-6-18 00:35

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表