Beispiel #1
0
        public void CopyFileToClient(string filePath, string clientFilePath, System.Net.IPAddress clientAddress, string networkName, int networkPort)
        {
            System.IO.FileStream serverFile    = new System.IO.FileStream(filePath, System.IO.FileMode.Open, System.IO.FileAccess.Read);
            SystemUtility        clientUtility = (SystemUtility)System.Runtime.Remoting.RemotingServices.Connect(typeof(SystemUtility), string.Format("tcp://{0}:{1}/{2}", clientAddress.GetString(), networkPort, networkName));

            System.IO.FileStream clientFile = clientUtility.CreateFile(clientFilePath);
            byte[] buffer = new byte[1 * 1024 * 1024];
            int    readcount;

            do
            {
                readcount = serverFile.Read(buffer, 0, buffer.Length);
                clientFile.Write(buffer, 0, readcount);
            }while (readcount > 0);
            serverFile.Close();
            clientFile.Close();
            serverFile.Dispose();
            clientFile.Dispose();
        }
Beispiel #2
0
        public void SendMessage(string sender, string message, System.Net.IPAddress clientAddress, string networkName, int networkPort)
        {
            SystemUtility clientUtility = (SystemUtility)System.Runtime.Remoting.RemotingServices.Connect(typeof(SystemUtility), string.Format("tcp://{0}:{1}/{2}", clientAddress.GetString(), networkPort, networkName));

            clientUtility.SendMessage(sender, message);
        }