using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ServiceModel; namespace FileSendReceive { [ServiceContract(CallbackContract = typeof(IFileHost))] public interface IFileHost { [OperationContract(IsOneWay = true)] void SendFileToAll(string name, byte[] fa); } [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)] class FileHost : IFileHost { Form1 mfp; public FileHost(Form1 mfp) { this.mfp = mfp; } public void SendFileToAll(string name, byte[] fa) { mfp.ReceiveFile(name, fa); } } }