public static void Main() { BasicHttpBinding binding = new BasicHttpBinding(); EndpointAddress ea = new EndpointAddress( new Uri("http://localhost:8080/ChatServer")); IPeerResolverContract proxy = ChannelFactory <IPeerResolverContract> .CreateChannel(binding, ea); try { Guid guid = Guid.NewGuid(); Console.WriteLine(guid); ResolveInfo ri = new ResolveInfo( guid, "net.p2p://chatMesh/ChatServer", 1); ResolveResponseInfo rri = proxy.Resolve(ri); Console.WriteLine("Response: {0}", rri); } catch (Exception e) { Console.WriteLine(e.Message); } }
public static void Main() { BasicHttpBinding binding = new BasicHttpBinding(); EndpointAddress ea = new EndpointAddress( new Uri("http://localhost:8080/ChatServer")); IPeerResolverContract proxy = ChannelFactory <IPeerResolverContract> .CreateChannel(binding, ea); // try { Guid guid = Guid.NewGuid(); Console.WriteLine(guid); RegisterInfo ri = new RegisterInfo( guid, "net.p2p://chatMesh/ChatServer", new PeerNodeAddress(new EndpointAddress("http://localhost:8080/ChatServer"), new ReadOnlyCollection <System.Net.IPAddress> (new List <System.Net.IPAddress> ()))); RegisterResponseInfo rri = proxy.Register(ri); Console.WriteLine("Response: {0}", rri); // } // catch (Exception e) { // Console.WriteLine (e.Message); // } }