您当前的位置: 首页 >  unity工具人 网络

c#网络唤醒局域网内计算机(用mac地址)

unity工具人 发布时间:2020-08-26 10:35:03 ,浏览量:4

方法一:

 public void WakeUp(string macString)
    {
        try
        {
            if (macString.Split('-').Length == 6)
            {
                string macStr = macString.Replace('-', ' '); ;

                byte[] macByteArray = HexStringSToByteArray(macStr);

                UdpClient client = new UdpClient();
                client.Connect(IPAddress.Broadcast, 1234);//IPAddress.Broadcast:默认广播地址"255.255.255.255"
                //client.Connect("127.0.0.1", 1234);

                //print(IPAddress.Broadcast);

                byte[] packet = new byte[17 * 6];
                for (int i = 0; i             
关注
打赏
1688896170
查看更多评论
0.0652s