|
发表于 2010-5-6 17:55:59
|
显示全部楼层
#AutoIt3Wrapper_run_debug_mode=Y
#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)
msgBox(0,"发送",$socket)
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(@IPAddress1,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)
MsgBox(0,"接收",$socket)
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 |
|