找回密码
 加入
搜索
查看: 2929|回复: 2

[网络通信] 求助,客户端下线后,服务端实现改变图片显示状况。

[复制链接]
发表于 2011-9-26 17:38:09 | 显示全部楼层 |阅读模式
本帖最后由 x163169x 于 2011-9-26 17:39 编辑

改变自xms77大哥的源程序

如何实现客户端下线后,服务端显示图片为OFFLINE.JPG  

服务器端
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=C:\WINDOWS\system32\SHELL32.dll
#AutoIt3Wrapper_Res_Description=在线机器信息查看(机器号,线号,产品,IP,软件版本)
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Copy Right 2011
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
#Include <Array.au3>
#include <FTPEx.au3>

#Region ### START Koda GUI section ### Form=d:\autoit3\koda formdesigner\koda_1.7.3.0\forms\软件检测器.kxf
Opt('GUIOnEventMode', 1)

Dim $Computer[1019],$Pic[1019]

$Form1 = GUICreate("客户机运行状态", 1438, 830, 1, 1)
GUISetOnEvent(-3, '_exit')
                  
$Computer[1001] = GUICtrlCreateLabel("1001", 60, 68, 25, 10)
$Computer[1002] = GUICtrlCreateLabel("1002", 60, 92, 25, 10)
$Computer[1003] = GUICtrlCreateLabel("1003", 60, 116, 25, 10)
$Computer[1004] = GUICtrlCreateLabel("1004", 60, 140, 25, 10)
$Computer[1005] = GUICtrlCreateLabel("1005", 60, 165, 25, 10)
$Computer[1006] = GUICtrlCreateLabel("1006", 60, 190, 25, 10)
$Computer[1007] = GUICtrlCreateLabel("1007", 60, 214, 25, 10)
$Computer[1008] = GUICtrlCreateLabel("1008", 60, 238, 25, 10)
$Computer[1009] = GUICtrlCreateLabel("1009", 60, 261, 25, 10)
$Computer[1010] = GUICtrlCreateLabel("1010", 60, 285, 25, 10)
$Computer[1011] = GUICtrlCreateLabel("1011", 60, 309, 25, 10)
$Computer[1012] = GUICtrlCreateLabel("1012", 60, 333, 25, 10)
$Computer[1013] = GUICtrlCreateLabel("1013", 60, 359, 25, 10)
$Computer[1014] = GUICtrlCreateLabel("1014", 60, 383, 25, 10)
$Computer[1015] = GUICtrlCreateLabel("1015", 60, 407, 25, 10)
$Computer[1016] = GUICtrlCreateLabel("1016", 60, 431, 25, 10)
$Computer[1017] = GUICtrlCreateLabel("1017", 60, 452, 25, 10)
$Computer[1018] = GUICtrlCreateLabel("1018", 60, 476, 25, 10)



$Pic[1001] = GUICtrlCreatePic("c:\offline.jpg", 166, 67, 10, 10)
$Pic[1002] = GUICtrlCreatePic("c:\offline.jpg", 166, 91, 10, 10)
$Pic[1003] = GUICtrlCreatePic("c:\offline.jpg", 166, 115, 10, 10)
$Pic[1004] = GUICtrlCreatePic("c:\offline.jpg", 166, 140, 10, 10)
$Pic[1005] = GUICtrlCreatePic("c:\offline.jpg", 166, 164, 10, 10)
$Pic[1006] = GUICtrlCreatePic("c:\offline.jpg", 166, 189, 10, 10)
$Pic[1007] = GUICtrlCreatePic("c:\offline.jpg", 166, 212, 10, 10)
$Pic[1008] = GUICtrlCreatePic("c:\offline.jpg", 166, 237, 10, 10)
$Pic[1009] = GUICtrlCreatePic("c:\offline.jpg", 166, 260, 10, 10)
$Pic[1010] = GUICtrlCreatePic("c:\offline.jpg", 166, 285, 10, 10)
$Pic[1011] = GUICtrlCreatePic("c:\offline.jpg", 166, 310, 10, 10)
$Pic[1012] = GUICtrlCreatePic("c:\offline.jpg", 166, 333, 10, 10)
$Pic[1013] = GUICtrlCreatePic("c:\offline.jpg", 166, 358, 10, 10)
$Pic[1014] = GUICtrlCreatePic("c:\offline.jpg", 166, 382, 10, 10)
$Pic[1015] = GUICtrlCreatePic("c:\offline.jpg", 166, 407, 10, 10)
$Pic[1016] = GUICtrlCreatePic("c:\offline.jpg", 166, 430, 10, 10)
$Pic[1017] = GUICtrlCreatePic("c:\offline.jpg", 166, 452, 10, 10)
$Pic[1018] = GUICtrlCreatePic("c:\offline.jpg", 166, 475, 10, 10)



GUICtrlSetOnEvent(-1, '_zx')


GUISetState()

UDPStartup()
$socket = UDPBind(@IPAddress1, 3001)
If @error <> 0 Then 
        MsgBox(0,"Error", "Server port open error")
        $Server_open = 0
EndIf
While 1
        ;If $Server_open <> 0 Then
                $data = UDPRecv($socket, 128,1)
                If $data <> "" Then
                        $data = BinaryToString($data,4)
                        $Data_array = StringSplit($data,",")
                        If $Data_array[0] = 2 Then
                        ;_ArrayDisplay($Data_array)
                                $Number = number(StringMid($Data_array[1],4,1)&StringRight($Data_array[1],3))
if $Data_array[2]="Counting..." then
                                GUICtrlSetImage($pic[$Number], "c:\online.jpg")
else
                                GUICtrlSetImage($pic[$Number], "c:\locked.jpg")
endif

                        EndIf
                ELSE
                EndIf
        ;EndIf
        Sleep(100)
WEnd        


        
        
Func _exit()
        Switch @GUI_CtrlId
                        Case -3
                                UDPShutdown()
                Exit      
        EndSwitch
EndFunc 
 楼主| 发表于 2011-9-26 20:57:20 | 显示全部楼层
继续求助。
 楼主| 发表于 2011-9-27 09:17:28 | 显示全部楼层
继续求助。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-16 02:35 , Processed in 0.077684 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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