private void SendPackageExe() { try { var dat = sendingPack.SerializeBin(); Send(dat, sendingPack.targetIPs, sendingPack.targetPorts); sendingPack.Reset(); } catch (Exception) { SetEvent(DSEvent.Error, "Send Package error"); } }
public void SendPackages(Socket handler) { if (!packageNeedToSend.isEmpty()) { var dat = packageNeedToSend.SerializeBin(); var byteList = new List <byte>(); var length = dat.Length; var lengthBytes = BitConverter.GetBytes((length + 4)); byteList.AddRange(lengthBytes); byteList.AddRange(dat); Send(handler, byteList.ToArray()); packageNeedToSend.Reset(); } }