Example #1
0
        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);
        }
Example #2
0
        public myFiles(FileInfo file)
        {
            this.ID   = 1;
            this.Name = file.Name;
            this.Date = file.LastAccessTime;
            this.Byte = file.Length;
            this.Path = file.FullName;

            FileStream   stream = File.Open(file.FullName, FileMode.Open);
            StreamReader reader = new StreamReader(stream);

            this.MD5 = CreateMD5.GetMD5HashData(reader.ReadToEnd().ToString());
            reader.Close();
        }