コード例 #1
0
        //! metaverseserver entry point.  Processes commandline arguments; starts dbinterface and serverfileagent components; handles initialization
        public void Init(IConfigSource commandlineConfig, IServerControllers controllers)
        {
            config = Config.GetInstance();

            Test.Info("*** Server starting ***");

            Running = true;

            network = new NetworkLevel2Controller();

            ServerPort = commandlineConfig.Configs["CommandLineArgs"].GetInt("serverport", config.ServerPort);
            Test.Debug("Creating Metaverse Client listener on port " + ServerPort);

            network.ListenAsServer(ServerPort);

            network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);
            network.Disconnection += new Level2DisconnectionHandler(network_Disconnection);

            rpc = new RpcController(network);
            netreplicationcontroller = new NetReplicationController(rpc);
            World = new WorldModel(netreplicationcontroller);

            controllers.Plugin.LoadServerPlugins();

            Test.Info("*** Server initialization complete ***");
        }
コード例 #2
0
 public RpcController(NetworkLevel2Controller network)
 {
     this.network = network;
     network.RegisterPacketConsumer(RpcType, new Level2ReceivedPacketHandler(network_ReceivedPacket));
     //network.ReceivedPacket += new Level2ReceivedPacketHandler(network_ReceivedPacket);
     //network.NetworkChangeState += new Level1NetworkChangeStateHandler( _NetworkChangeState );
     isserver = network.IsServer;
 }
コード例 #3
0
ファイル: TestNetRpc.cs プロジェクト: beyonddiana/osmp-cs
            public void Go()
            {
                network = new NetworkLevel2Controller();
                network.ConnectAsClient(serveraddress, serverport);
                network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);

                while (true)
                {
                    network.Tick();
                    Thread.Sleep(50);
                }
            }
コード例 #4
0
 public DirtyObjectController( NetReplicationController netreplicationcontroller, NetworkLevel2Controller network, RpcController rpc )
 {
     if (!network.IsServer)
     {
         throw new Exception( "Shouldnt be instantiating dirtyobjectcontroller on client" );
     }
     this.netreplicationcontroller = netreplicationcontroller;
     this.rpc = rpc;
     this.network = network;
     //network = NetworkControllerFactory.GetInstance();
     network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);
     network.Disconnection += new Level2DisconnectionHandler(network_Disconnection);
 }
コード例 #5
0
 public DirtyObjectController(NetReplicationController netreplicationcontroller, NetworkLevel2Controller network, RpcController rpc)
 {
     if (!network.IsServer)
     {
         throw new Exception("Shouldnt be instantiating dirtyobjectcontroller on client");
     }
     this.netreplicationcontroller = netreplicationcontroller;
     this.rpc     = rpc;
     this.network = network;
     //network = NetworkControllerFactory.GetInstance();
     network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);
     network.Disconnection += new Level2DisconnectionHandler(network_Disconnection);
 }
コード例 #6
0
 public void Go()
 {
     net = new NetworkLevel2Controller();
     net.ListenAsServer(3456);
     net.NewConnection += new Level2NewConnectionHandler(net_NewConnection);
     net.Disconnection += new Level2DisconnectionHandler(net_Disconnection);
     net.RegisterPacketConsumer('Z', new Level2ReceivedPacketHandler(net_ReceivedPacket));
     //net.ReceivedPacket += new Level2ReceivedPacketHandler(net_ReceivedPacket);
     // net.ListenAsServer( 3457 );
     while (true)
     {
         net.Tick();
         Thread.Sleep(50);
     }
 }
コード例 #7
0
        Hashtable unsafepackethandlers = new Hashtable(); // packets which dont have correct sharedsecret, or sharedsecret not yet validated

        #endregion Fields

        #region Constructors

        public NetworkLevel2Connection( NetworkLevel2Controller parent, ConnectionInfo connectioninfo, bool isserver )
        {
            LogFile.WriteLine("NetworkLevel2Connection()");

            networkimplementation = parent.networkimplementation;
            this.connectioninfo = connectioninfo;

            this.parent = parent;
            //this.connection = connectioninfo.Connection;
            this.isserver = isserver;

            lasttimestamp = DateTime.Now;

            packetreferencecontroller = new NetPacketReferenceController( this, isserver );
            sharedsecretexchange = new NetSharedSecretExchange( this, isserver );
            //sharedsecretexchange.Tick();
        }
コード例 #8
0
        public NetworkLevel2Connection(NetworkLevel2Controller parent, ConnectionInfo connectioninfo, bool isserver)
        {
            LogFile.WriteLine("NetworkLevel2Connection()");

            networkimplementation = parent.networkimplementation;
            this.connectioninfo   = connectioninfo;

            this.parent = parent;
            //this.connection = connectioninfo.Connection;
            this.isserver = isserver;

            lasttimestamp = DateTime.Now;

            packetreferencecontroller = new NetPacketReferenceController(this, isserver);
            sharedsecretexchange      = new NetSharedSecretExchange(this, isserver);
            //sharedsecretexchange.Tick();
        }
コード例 #9
0
ファイル: TestNetRpc.cs プロジェクト: beyonddiana/osmp-cs
            public void Go()
            {
                network = new NetworkLevel2Controller();
                network.ListenAsServer(serverport);
                network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);

                RpcController rpc = new RpcController(network);

                TestController.GetInstance().rpc = rpc;

                while (true)
                {
                    network.Tick();
                    Thread.Sleep(50);
                }
                //Testing.TestInterface_ClientProxy testinterface_clientproxy = new OSMP.Testing.TestInterface_ClientProxy( rpc,
            }
コード例 #10
0
            public void Go()
            {
                net = new NetworkLevel2Controller();
                net.ConnectAsClient("127.0.0.1", 3456);

                net.NewConnection += new Level2NewConnectionHandler(net_NewConnection);
                net.Disconnection += new Level2DisconnectionHandler(net_Disconnection);
                net.RegisterPacketConsumer('Z', new Level2ReceivedPacketHandler(net_ReceivedPacket));
                //net.ReceivedPacket += new Level2ReceivedPacketHandler(net_ReceivedPacket);

                while (true)
                {
                    net.Tick();
                    //net.ConnectionToServer.Send( 'P', Encoding.ASCII.GetBytes( "sample data " + i.ToString() ) );
                    Thread.Sleep(50);
                    //    i++;
                }
            }
コード例 #11
0
ファイル: TestLevel2.cs プロジェクト: hughperkins/osmp-cs
            public void Go()
            {
                net = new NetworkLevel2Controller();
                net.ConnectAsClient("127.0.0.1", 3456);

                net.NewConnection += new Level2NewConnectionHandler(net_NewConnection);
                net.Disconnection += new Level2DisconnectionHandler(net_Disconnection);
                net.RegisterPacketConsumer('Z', new Level2ReceivedPacketHandler(net_ReceivedPacket));
                //net.ReceivedPacket += new Level2ReceivedPacketHandler(net_ReceivedPacket);

                while (true)
                {
                    net.Tick();
                    //net.ConnectionToServer.Send( 'P', Encoding.ASCII.GetBytes( "sample data " + i.ToString() ) );
                    Thread.Sleep(50);
                //    i++;
                }
            }
コード例 #12
0
        //! metaverseserver entry point.  Processes commandline arguments; starts dbinterface and serverfileagent components; handles initialization
        public void Init( IConfigSource commandlineConfig, IServerControllers controllers )
        {
            config = Config.GetInstance();

            Test.Info("*** Server starting ***");

            Running = true;

            network = new NetworkLevel2Controller();

            ServerPort = commandlineConfig.Configs["CommandLineArgs"].GetInt( "serverport", config.ServerPort );
            Test.Debug("Creating Metaverse Client listener on port " + ServerPort );

            network.ListenAsServer(ServerPort);

            network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);
            network.Disconnection += new Level2DisconnectionHandler(network_Disconnection);

            rpc = new RpcController(network);
            netreplicationcontroller = new NetReplicationController( rpc );
            World = new WorldModel(netreplicationcontroller);

            controllers.Plugin.LoadServerPlugins();

            Test.Info("*** Server initialization complete ***");
        }
コード例 #13
0
        public int Init( IConfigSource commandlineConfig, IClientControllers controllers )
        {
            Type type = Type.GetType( "OSMP.ObjectReplicationClientToServer" );
            LogFile.WriteLine( "type: [" + type + "] " + type.AssemblyQualifiedName );
            //System.Environment.Exit( 0 );

            Tao.DevIl.Il.ilInit();
               	Tao.DevIl.Ilu.iluInit();

            config = Config.GetInstance();

            string serverip = commandlineConfig.Configs["CommandLineArgs"].GetString( "serverip", config.ServerIPAddress );
            int port = commandlineConfig.Configs["CommandLineArgs"].GetInt( "serverport", config.ServerPort );

            network = new NetworkLevel2Controller();
            network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);

            network.ConnectAsClient(serverip, port);

            rpc = new RpcController(network);
            netreplicationcontroller = new NetReplicationController(rpc);

            renderer = RendererFactory.GetInstance();
            renderer.Tick += new OSMP.TickHandler( MainLoop );
            renderer.Init();

            worldstorage = new WorldModel(netreplicationcontroller);
            worldview = new WorldView( worldstorage );
            playermovement = PlayerMovement.GetInstance();

            InitializePlayermovement();

            myavatar = new Avatar();
            worldstorage.AddEntity(myavatar);

               controllers.Plugin.LoadClientPlugins();
            if (!commandlineConfig.Configs["CommandLineArgs"].Contains("nochat" ))
            {
                LoadChat();
            }

            if( commandlineConfig.Configs["CommandLineArgs"].Contains("url" ) )
            {
            string url = commandlineConfig.Configs["CommandLineArgs"].GetString("url" );
                LogFile.WriteLine( "url: " +  url);

                if (url.StartsWith( "osmp://" ))
                {
                    targettoload = "http://" + url.Substring( "osmp://".Length );
                    LogFile.WriteLine( "target: " + targettoload );
                }
                else
                {
                    targettoload = url;
                }
            }

            renderer.StartMainLoop();

            return 0;
        }
コード例 #14
0
 public GuaranteedPackets()
 {
     networklevel2controller = new NetworkLevel2Controller();
     net.RegisterPacketHandler('P', this);
 }
コード例 #15
0
 public GuaranteedPackets()
 {
     networklevel2controller = new NetworkLevel2Controller();
     net.RegisterPacketHandler( 'P', this );
 }
コード例 #16
0
ファイル: TestNetRpc.cs プロジェクト: hughperkins/osmp-cs
            public void Go()
            {
                network = new NetworkLevel2Controller();
                network.ConnectAsClient(serveraddress, serverport);
                network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);

                while (true)
                {
                    network.Tick();
                    Thread.Sleep(50);
                }
            }
コード例 #17
0
        public int Init(IConfigSource commandlineConfig, IClientControllers controllers)
        {
            Type type = Type.GetType("OSMP.ObjectReplicationClientToServer");

            LogFile.WriteLine("type: [" + type + "] " + type.AssemblyQualifiedName);
            //System.Environment.Exit( 0 );

            Tao.DevIl.Il.ilInit();
            Tao.DevIl.Ilu.iluInit();

            config = Config.GetInstance();

            string serverip = commandlineConfig.Configs["CommandLineArgs"].GetString("serverip", config.ServerIPAddress);
            int    port     = commandlineConfig.Configs["CommandLineArgs"].GetInt("serverport", config.ServerPort);

            network = new NetworkLevel2Controller();
            network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);

            network.ConnectAsClient(serverip, port);

            rpc = new RpcController(network);
            netreplicationcontroller = new NetReplicationController(rpc);

            renderer       = RendererFactory.GetInstance();
            renderer.Tick += new OSMP.TickHandler(MainLoop);
            renderer.Init();

            worldstorage   = new WorldModel(netreplicationcontroller);
            worldview      = new WorldView(worldstorage);
            playermovement = PlayerMovement.GetInstance();

            InitializePlayermovement();

            myavatar = new Avatar();
            worldstorage.AddEntity(myavatar);


            controllers.Plugin.LoadClientPlugins();
            if (!commandlineConfig.Configs["CommandLineArgs"].Contains("nochat"))
            {
                LoadChat();
            }

            if (commandlineConfig.Configs["CommandLineArgs"].Contains("url"))
            {
                string url = commandlineConfig.Configs["CommandLineArgs"].GetString("url");
                LogFile.WriteLine("url: " + url);

                if (url.StartsWith("osmp://"))
                {
                    targettoload = "http://" + url.Substring("osmp://".Length);
                    LogFile.WriteLine("target: " + targettoload);
                }
                else
                {
                    targettoload = url;
                }
            }

            renderer.StartMainLoop();

            return(0);
        }
コード例 #18
0
ファイル: TestNetRpc.cs プロジェクト: hughperkins/osmp-cs
            public void Go()
            {
                network = new NetworkLevel2Controller();
                network.ListenAsServer(serverport);
                network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);

                RpcController rpc = new RpcController(network);
                TestController.GetInstance().rpc = rpc;

                while (true)
                {
                    network.Tick();
                    Thread.Sleep(50);
                }
                    //Testing.TestInterface_ClientProxy testinterface_clientproxy = new OSMP.Testing.TestInterface_ClientProxy( rpc,
            }
コード例 #19
0
ファイル: TestLevel2.cs プロジェクト: hughperkins/osmp-cs
 public void Go()
 {
     net = new NetworkLevel2Controller();
     net.ListenAsServer(3456);
     net.NewConnection += new Level2NewConnectionHandler(net_NewConnection);
     net.Disconnection += new Level2DisconnectionHandler(net_Disconnection);
     net.RegisterPacketConsumer('Z', new Level2ReceivedPacketHandler(net_ReceivedPacket));
     //net.ReceivedPacket += new Level2ReceivedPacketHandler(net_ReceivedPacket);
     // net.ListenAsServer( 3457 );
     while (true)
     {
         net.Tick();
         Thread.Sleep(50);
     }
 }