找回密码
 加入
搜索
查看: 1565|回复: 3

[AU3基础] A 服务器 - B 客户机[已解决]

[复制链接]
发表于 2012-3-11 05:26:46 | 显示全部楼层 |阅读模式
本帖最后由 gfuchao 于 2012-3-12 02:34 编辑

环境 局域网
A 服务器
B 客户机

我在客户机上运行某软件或者用AU3写的,点击一下运行按扭(按扭功能:运行a.exe文件)

A 服务器就会就行运行本地文件 a.exe

请问这个有没有例子或相关资料。
发表于 2012-3-11 09:36:01 | 显示全部楼层
psexec,最近刚好有看到,坛子里有
发表于 2012-3-11 14:32:35 | 显示全部楼层
利用UDPSend、UDPRecv
(单击环境实验成功,从帮助文件里的例子改过来的,局域网应该也可以.....)
server端代码
#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)
Local $msg ,$data
GUICreate("My GUI Button")
GUISetState()

UDPStartup()
OnAutoItExitRegister("Cleanup")
Local $socket = UDPBind("127.0.0.1", 65532)
If @error <> 0 Then Exit

While 1
        $msg = GUIGetMsg()
        Select
                Case $msg = $GUI_EVENT_CLOSE
                        ExitLoop
        EndSelect
    $data = UDPRecv($socket, 50)
    If $data <> "" Then
        Run($data)
    EndIf
WEnd

Func Cleanup()
    UDPCloseSocket($socket)
    UDPShutdown()
EndFunc
client端
#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
Local $Button_2, $msg
GUICreate("My GUI Button")
Opt("GUICoordMode", 2)
Local $Button_2 = GUICtrlCreateButton("Button Test", 0, -1)
GUISetState()

UDPStartup()
OnAutoItExitRegister("Cleanup")
Local $socket = UDPOpen("127.0.0.1", 65532)
If @error <> 0 Then Exit

While 1
        $msg = GUIGetMsg()
        Select
                Case $msg = $GUI_EVENT_CLOSE
                        ExitLoop
                Case $msg = $Button_2
                        Local $status = UDPSend($socket, "C:\WINDOWS\notepad.exe")
                        If $status = 0 then 
                                MsgBox(0, "错误", "当发送 UDP 消息时发生错误: " & @error)
                                Exit
                        EndIf
        EndSelect
WEnd

评分

参与人数 2金钱 +35 贡献 +2 收起 理由
gfuchao + 10 + 1 我早上的时候已经解决了,不过还是要谢谢你
afan + 25 + 1

查看全部评分

发表于 2012-3-12 09:03:22 | 显示全部楼层
用TCP协议更稳定点哈。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-30 19:38 , Processed in 0.106257 second(s), 27 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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