old mode 100755
new mode 100644
| | |
| | | //本地Socket |
| | | private static Socket busSocket; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 启动Socket接收和发送功能 |
| | | /// </summary> |
| | |
| | | |
| | | asyncBeginReceive (); |
| | | |
| | | Console.WriteLine ("BusSocket启动成功!"); |
| | | Utlis.WriteLine ("BusSocket启动成功!"); |
| | | Control.IsEnterBackground = false; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | catch { } |
| | | busSocket = null; |
| | | |
| | | Console.WriteLine("BusSocket关闭成功!"); |
| | | } |
| | | Utlis.WriteLine("BusSocket关闭成功!"); |
| | | Control.IsEnterBackground = true; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 当前的Socket是否运行 |
| | |
| | | Packet packet = new Packet (); |
| | | |
| | | busSocket.BeginReceiveFrom (packet.Bytes, 0, packet.Bytes.Length, SocketFlags.None, ref packet.RemoteEndPoint, new AsyncCallback (asyncEndReceive), packet); |
| | | |
| | | |
| | | } |
| | | catch (Exception e) { |
| | |
| | | byte[] bytes = packet.Bytes; |
| | | packet.Bytes = new byte[len]; |
| | | System.Array.Copy(bytes, 0, packet.Bytes, 0, packet.Bytes.Length); |
| | | |
| | | packet.Manager(); |
| | | } |
| | | catch { } |
| | |
| | | } |
| | | tempPacket.FlagDateTime = System.DateTime.Now; |
| | | tempPacket.HaveSendCount++; |
| | | busSocket.BeginSendTo(tempPacket.Bytes, 0, tempPacket.Bytes.Length, SocketFlags.None, tempPacket.RemoteEndPoint, new AsyncCallback(asyncEndSend), tempPacket); |
| | | byte [] messageSend; |
| | | //2020-01-14 增加本地通讯加密 |
| | | if (UserConfig.Instance.IsLocalEncrypt) { |
| | | messageSend = Shared.Securitys.EncryptionService.AesEncryptPayload (tempPacket.Bytes, UserConfig.Instance.LocalEncryptKey); |
| | | } else { |
| | | messageSend = tempPacket.Bytes; |
| | | } |
| | | |
| | | busSocket.BeginSendTo(messageSend, 0, messageSend.Length, SocketFlags.None, tempPacket.RemoteEndPoint, new AsyncCallback(asyncEndSend), tempPacket); |
| | | } |
| | | catch { |
| | | |