internal static string sendProtocol(string theMessageToSend, Socket senderSock2) { senderSock = senderSock2; if (theMessageToSend.Contains("SEND")) { // crea il json della cartella del client string value = @"C:\Users\Pc\Desktop\CLIENT"; var json = CreateJson.GetDirectory(new DirectoryInfo(value)); request("SEND " + json.ToString()); return("SEND " + json.ToString()); } else if (theMessageToSend.Contains("SET")) { string value = @"C:\Users\Pc\Desktop\CLIENT\a.txt"; int bytesSend = myFiles.sendFile(value, senderSock2); return("a.txt"); } else if (theMessageToSend.Contains("GET")) { request("+GET FILE"); return("+GET FILE"); } return(null); }
internal static string Send(Socket senderSock2, string theMessageToSend) { var json = CreateJson.GetDirectory(new DirectoryInfo(@"C:\Users\Pc\Desktop\CLIENT")); string MD5 = CreateMD5.GetMD5HashData("value"); // Sends data to a connected Socket. //int bytesSend = myFiles.sendFile(value, senderSock2); string response = null; // Sending message //string theMessageToSend = ""; if (theMessageToSend.Contains("QUIT")) { Protocol.request("QUIT\r\n"); } else { response = Protocol.sendProtocol(theMessageToSend, senderSock2); ReceiveDataFromServer(senderSock2); } return(response); }