Beispiel #1
0
 public static void Run(int port, ITrace trace)
 {
     File.Delete("RemoteHost.txt");
     using (TestOutputFile =
                new StreamWriter(
                    File.Open("RemoteHost.txt", FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None)))
     {
         var serializer = new Serializer <ISerializableMessage>();
         serializer.AddType <TestData>();
         serializer.AddType <TestControl>();
         var serverConfiguration = new ServerConfiguration(port);
         var server = new Net.Server(serverConfiguration, trace);
         Console.WriteLine("Starting server");
         server.NewServerPeer += (server1, serverPeer) =>
         {
             serverPeer.NewConnection += (serverPeer1, connection) => new ServerConnection(serializer, trace).Server_NewConnection(server1, connection);
         };
         server.StartReceiving();
         Console.WriteLine("Setting signal that we are up and running");
         using (var startEvent = EventWaitHandle.OpenExisting("testRemoteServer"))
         {
             startEvent.Set();
         }
         Console.WriteLine("Waiting for stop events");
         StopEvent.WaitOne(600000);
         server.Dispose();
     }
 }
Beispiel #2
0
        public OrganizationResult ToOrganizationResult(Net.Server server)
        {
            OrganizationResult result = new OrganizationResult();

            result.ID            = this.ID;
            result.Name          = this.Name;
            result.Faction       = this.Faction;
            result.LastUpdated   = this.LastUpdated;
            result.Members       = new OrganizationMembers();
            result.Members.Items = new OrganizationMember[this.Members.Length];
            for (int i = 0; i < this.Members.Length; i++)
            {
                result.Members.Items[i] = new OrganizationMember();
                result.Members.Items[i].FromWhoisResult(XML.GetWhois(this.Members[i], server, true, true, true));
            }
            return(result);
        }
 public void Server_NewConnection(Net.Server arg1, Connection arg2)
 {
     _typedConnection             = new TypedConnection <ISerializableMessage>(arg2, _serializer);
     _typedConnection.NewMessage += _typedConnection_NewMessage;
     //          _typedConnection.Send(new TestData(), ServiceTypes.ReliableOrdered);
 }