每次都是发送到3950条左右就不能再发送了.接收端应该是没问题.
发送端:#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
$ip=@IPAddress1
UDPStartup()
$socket = UDPBind(@IPAddress1, 65532)
If @error <> 0 Then Exit
$Form1 = GUICreate("测试-发送", 291, 208, 192, 114)
GUISetOnEvent($GUI_EVENT_CLOSE, "_ext")
$Edit1 = GUICtrlCreateEdit("", 8, 28, 273, 116, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_CLIPSIBLINGS,$ES_READONLY,$ws_VSCROLL))
GUICtrlSetData(-1, "")
$Button1 = GUICtrlCreateButton("退出[&Esc]", 168, 176, 113, 25, 0)
GUICtrlSetOnEvent(-1, "_ext")
GUISetState(@SW_SHOW)
While 1
$i = 1
While $i<80000
GUICtrlSetData($edit1, $i & @CRLF & GUICtrlRead($edit1))
$connect = UDPOpen("192.168.9.13",514);udp发送数据测试
$status = UDPSend($connect, StringToBinary($i ,4))
$i=$i+1
WEnd
WEnd
Func _ext()
UDPCloseSocket($socket)
UDPShutdown()
Exit
EndFunc
接收端:#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
$ip=@IPAddress1
UDPStartup()
$socket = UDPBind(@IPAddress1, 514)
If @error <> 0 Then Exit
$Form1 = GUICreate("测试-接收", 291, 208, 192, 114)
GUISetOnEvent($GUI_EVENT_CLOSE, "_ext")
$Edit1 = GUICtrlCreateEdit("", 8, 28, 273, 116, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_CLIPSIBLINGS,$ES_READONLY,$ws_VSCROLL))
GUICtrlSetData(-1, "")
$Button1 = GUICtrlCreateButton("退出[&Esc]", 168, 176, 113, 25, 0)
GUICtrlSetOnEvent(-1, "_ext")
GUISetState(@SW_SHOW)
While 1
$data = UDPRecv($socket, 500,1)
If $data <> "" Then
$data = BinaryToString($data,4)
GUICtrlSetData($edit1, $data & @CRLF & GUICtrlRead($edit1))
EndIf
WEnd
Func _ext()
UDPCloseSocket($socket)
UDPShutdown()
Exit
EndFunc
问题出在哪呢? 谢谢各位了 |