コード例 #1
0
        NetworkLevel2Connection connectiontoserver;                                                                    // used by client
        //bool connectionopen = false; // used by client

        //static NetworkModel instance = new NetworkModel();
        //public static NetworkModel GetInstance(){ return instance; }

        public NetworkLevel2Controller()
        {
            this.networkimplementation            = NetworkImplementationFactory.CreateNewInstance();
            networkimplementation.ReceivedPacket += new Level1ReceivedPacketHandler(ReceivedPacketHandler);
            //networkimplementation.NewConnection += new Level1NewConnectionHandler(networkimplementation_NewConnection);
            networkimplementation.Disconnection += new Level1DisconnectionHandler(networkimplementation_Disconnection);
        }
コード例 #2
0
ファイル: TestNetworkUdp.cs プロジェクト: beyonddiana/osmp-cs
 public void Go(int port)
 {
     net = NetworkImplementationFactory.CreateNewInstance();
     net.ListenAsServer(port);
     net.ReceivedPacket += new Level1ReceivedPacketHandler(net_ReceivedPacket);
     while (true)
     {
         net.Tick();
         Thread.Sleep(50);
     }
 }
コード例 #3
0
ファイル: TestNetworkUdp.cs プロジェクト: beyonddiana/osmp-cs
            public void Go(string ipaddress, int port)
            {
                INetworkImplementation net = NetworkImplementationFactory.CreateNewInstance();

                net.ConnectAsClient(ipaddress, port);
                net.ReceivedPacket += new Level1ReceivedPacketHandler(net_ReceivedPacket);
                net.Send(Encoding.UTF8.GetBytes("Hi, this is a test"));
                while (true)
                {
                    net.Tick();
                    Thread.Sleep(50);
                }
            }