找回密码
 加入
搜索
查看: 1969|回复: 1

[网络通信] TCP UDF的问题,2个客户端链接程序会卡住不动

[复制链接]
发表于 2017-5-9 16:25:08 | 显示全部楼层 |阅读模式
本帖最后由 heavenm 于 2017-5-9 16:44 编辑

http://autoitx.com/forum.php?mod ... ertype=0&page=1
#cs
        Download netcat at https://eternallybored.org/misc/netcat/
        Execute this script
        Run in CMD:
        nc -vv 127.0.0.1 8081
#ce

#include "TCPServer.au3"

; First we set the callback functions for the three events (none of them is mandatory)
_TCPServer_OnConnect("connected")
_TCPServer_OnDisconnect("disconnect")
_TCPServer_OnReceive("received")

; And some parameters
_TCPServer_DebugMode(True)
_TCPServer_SetMaxClients(10)

; Finally we start the server at port 8081 at any interface
_TCPServer_Start(7930)
Sleep(5000)
MsgBox(0, '','两个客户端连接,我就弹不出来了!')


Func connected($iSocket, $sIP)
;~         _TCPServer_Broadcast('new client connected guys', $iSocket)
        _TCPServer_Send($iSocket, $COOKIE_IQIYI & @CRLF)
        _TCPServer_SetParam($iSocket, "will write")
EndFunc   ;==>connected

Func disconnect($iSocket, $sIP)
        MsgBox(0, "Client disconnected", "Client " & $sIP & " disconnected from socket " & $iSocket)
EndFunc   ;==>disconnect

Func received($iSocket, $sIP, $sData, $sPar)
        MsgBox(0, "Data received from " & $sIP, $sData & @CRLF & "Parameter: " & $sPar)
        _TCPServer_Send($iSocket, "You wrote: " & $sData)
        _TCPServer_SetParam($iSocket, 'will write again')
EndFunc   ;==>received

While 1

        Sleep(100)
WEnd
用一个NC连接不会卡住,用两个的话会卡住

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2017-5-9 16:28:04 | 显示全部楼层
并不像作者所说,服务不会影响程序运行!只是好奇哈!
到底是哪里让他卡住了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-22 11:10 , Processed in 0.071142 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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