本帖最后由 顽固不化 于 2009-7-12 19:15 编辑 #include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
UDPStartup()
While 1
$socket = UDPBind("192.168.1.103", 65532)
If @error <> 0 Then
Sleep(200)
Else
ExitLoop
EndIf
WEnd
While 1
$socket1 = UDPOpen("192.168.1.100", 65532)
If @error <> 0 Then
Sleep(200)
Else
ExitLoop
EndIf
WEnd
HotKeySet("{esc}","_Exit")
opt("GUIOnEventMode",1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 800, 600, -1, -1)
$Pic1 = GUICtrlCreatePic("", 0, 0, 800, 600, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
#EndRegion ### END Koda GUI section ###
While 1
$data = UDPRecv($socket, 90000)
If $data <> "" Then
$file = FileOpen("Temp.jpg", 18)
FileWrite($file, $data)
FileClose($file)
GUICtrlSetImage($Pic1,"Temp.jpg")
EndIf
Sleep(100)
rev()
WEnd
Func rev()
$send = UDPSend($socket1, 'sendpicpls')
EndFunc ;==>rev
Func _exit()
Exit
EndFunc
改了一下“接受端”,可是像视频一样收看了。 |