wangbojing / NtyTcp

单线程用户态TCP/IP协议栈,epoll实现,包含服务器案例,并发测试案例
MIT License
677 stars 298 forks source link

您好,请教两个问题,如下: #7

Open d00353122 opened 4 years ago

d00353122 commented 4 years ago
  1. nty_example_epoll_rb_server 执行的时候,出现cpu占用率99%情况,连接server也无响应,请问作者有没有遇到过? 然后 NtyTcp协议栈的监听端口 可否用natstat 查询? root 1681 0.0 4.7 105240 47252 pts/0 S+ 11:55 0:00 gdb ./bin/nty_example_epoll_rb_se root 1683 99.0 2.1 381852 21084 pts/0 tLl 11:55 87:25 /home/ubuntu/workspace/NtyTcp/bin

2、nty_example_block_server执行出现段错误;如下: (gdb) 99 if (nty_listen(sockfd, 5) < 0) { (gdb)

Thread 1 "nty_example_blo" received signal SIGSEGV, Segmentation fault. 0x0000555555567e4b in HashListener (l=0x555555791a70) at nty_hash.c:93 93 return listener->s->s_addr.sin_port & (NUM_BINS_LISTENERS - 1); (gdb) bt

0 0x0000555555567e4b in HashListener (l=0x555555791a70) at nty_hash.c:93

1 0x0000555555568392 in ListenerHTInsert (ht=0x55555578d440, it=0x555555791a70)

at nty_hash.c:218

2 0x0000555555558bb0 in nty_listen (sockid=0, backlog=5) at nty_api.c:379

3 0x00005555555836ae in main () at nty_example_tcp_server.c:99

(gdb)

如上问题,想请教一下,谢谢;(怀疑环境配置还有哪里有问题,请作者帮忙指正一下)

wangbojing commented 4 years ago
  1. ntytcp是一个用户态的协议栈,启动以后,netstat是查看不到,占用端口情况的。
  2. nty_config.h 里面修改以下几个宏定义值,

    define NTY_SELF_IP "192.168.0.107" // 网络地址

    define NTY_SELF_IP_HEX 0x6B00A8C0 // 网络地址的16进制

    define NTY_SELF_MAC "00:0c:29:58:6f:f4" // 网卡的mac地址。

wangbojing commented 4 years ago

可以加入gitter: https://gitter.im/ntytcp/community