public bool SendFileToAll(string filePath, string destPath = "") { byte[] data = AddHead(filePath, destPath); if (data == null) { return(false); } _tcpServer.SendToAllClient(data, 0, data.Length); OnSendFile?.Invoke($"client:allClient,filepath:{filePath}"); return(true); }
public bool SendFile(string ip, string filePath, string destPath = "") { byte[] data = AddHead(filePath, destPath); if (data == null) { return(false); } _tcpServer.Send(ip, data, 0, data.Length); OnSendFile?.Invoke($"ip:{ip},filepath:{filePath}"); return(true); }
public bool SendFile(int connectId, string filePath, string destPath = "") { byte[] data = AddHead(filePath, destPath); if (data == null) { return(false); } _tcpServer.Send(connectId, data, 0, data.Length); OnSendFile?.Invoke($"connectid:{connectId.ToString()},filepath:{filePath}"); return(true); }
public int SendFileSyn(string fileName, string destFolder = "") { _synSendLength = SendFile(fileName, destFolder); if (Wait()) { OnSendFile?.Invoke(fileName); return(_synSendLength); } else { OnError?.Invoke($"SendFileSyn error {fileName}"); } return(0); }
public int SendFile(string fileName, string destFolder = "") { if (Connected) { byte[] data = AddHead(fileName, destFolder); if (data != null) { _tcpClients.Send(data, 0, data.Length); OnSendFile?.Invoke(fileName); return(data.Length); } else { OnError?.Invoke($"Read file error {fileName}"); } } return(0); }