吾爱破解软件站

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
开启左侧

局域网多媒体中控控制 (音量、关机、心跳)

[复制链接]
wtujoxk 发表于 2022-5-24 14:48:00 | 显示全部楼层 |阅读模式
本帖最后由 wtujoxk 于 2022-5-25 13:58 编辑

软件使用UDP协议编写,针对多媒体中控控制电脑的音量,关机,心跳这三个功能进行编写!
通讯协议在说明栏中,运行软件会在当前目录下生成一个config.txt文件,里面保存了设置!
修改参数设置后,记得点一下保存!







下载地址:https://nns.lanzoub.com/iChp405dce2h

调试助手下载地址:https://nns.lanzoub.com/iq1D305dcpgh
使用调试助手可以测试软件可用性!

20220525添加心跳测试小软件
用法见下图


心跳测试小软件下载:https://nns.lanzoub.com/iEVjg05etele
源码:
[C#] 纯文本查看 复制代码
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using System.Net.Sockets;
using System.Net;

namespace 心跳测试
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        //在线电脑集合
        Dictionary<string, DateTime> dicComputer = new Dictionary<string, DateTime>();
        private void Form1_Load(object sender, EventArgs e)
        {
            new Thread(() =>
            {
                UdpClient uc = new UdpClient(new IPEndPoint(IPAddress.Any, 5467));
                //设置UDP超时接收时间
                uc.Client.ReceiveTimeout = 4000;
                while (true)
                {
                    try
                    {
                        IPEndPoint ipEndPoint = null;
                        byte[] bytes = uc.Receive(ref ipEndPoint);
                        this.Invoke((EventHandler)delegate { textBox1.Text = string.Empty; });
                        string computer = ipEndPoint.Address.ToString();

                        if (!dicComputer.ContainsKey(computer))
                            dicComputer.Add(computer, DateTime.Now);
                        else
                            dicComputer[computer] = DateTime.Now;

                        //心跳时间为2秒一次,筛选离线电脑
                        dicComputer = dicComputer.Where(x => (DateTime.Now - x.Value).Seconds < 4).ToDictionary(x => x.Key, x => x.Value);

                        foreach (var onlineComputer in dicComputer)
                        {
                            this.Invoke((EventHandler)delegate
                            {
                                textBox1.AppendText(onlineComputer + "   电脑在线" + Environment.NewLine);
                            });
                        }

                    }
                    catch (Exception ex)
                    {
                        //心跳时间为2秒一次,如果服务端4秒钟都未收到新消息,则认为所有电脑离线
                        this.Invoke((EventHandler)delegate { textBox1.Text = "没有电脑在线"; });
                    }
                }
            })
            { IsBackground = true }.Start();
        }
    }
}

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

gztf 发表于 2022-5-24 15:04:00 | 显示全部楼层
不错,收藏备用
回复

使用道具 举报

weiya909 发表于 2022-5-24 15:03:00 | 显示全部楼层
支持下。。。。。。。。。。
回复

使用道具 举报

xjhbbs 发表于 2022-5-24 14:50:00 | 显示全部楼层
这个牛, 网管 专用 ,,,, 感谢楼主的分享
回复

使用道具 举报

w-c-f5522 发表于 2022-5-24 15:16:00 | 显示全部楼层
局域网内电脑,远程关机,如何操作?
回复

使用道具 举报

mokson 发表于 2022-5-24 15:23:00 | 显示全部楼层
关机&nbsp;&nbsp;控制端 怎么发命令
回复

使用道具 举报

szw521 发表于 2022-5-24 15:37:00 | 显示全部楼层
控制端?服务器端?
回复

使用道具 举报

my9258 发表于 2022-5-24 15:44:00 | 显示全部楼层
这是干嘛用的呢?
回复

使用道具 举报

yzhome 发表于 2022-5-24 15:58:00 | 显示全部楼层
功能太少了&nbsp; &nbsp; 建议加入播放停止&nbsp;&nbsp;运行程序&nbsp; &nbsp; 发送udp指令等功能
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|小黑屋|吾爱破解软件站

GMT+8, 2024-5-9 05:35 , Processed in 0.028825 second(s), 14 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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