Exemplo n.º 1
0
 public void Go(int port)
 {
     net = NetworkImplementationFactory.CreateNewInstance();
     net.ListenAsServer(port);
     net.ReceivedPacket += new Level1ReceivedPacketHandler(net_ReceivedPacket);
     while (true)
     {
         net.Tick();
         Thread.Sleep(50);
     }
 }
Exemplo n.º 2
0
            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);
                }
            }
Exemplo n.º 3
0
 public void Tick()
 {
     networkimplementation.Tick();
     if (IsServer)
     {
         foreach (NetworkLevel2Connection networkmodelconnection in connections.Values)
         {
             //NetworkLevel2Connection networkmodelconnection = dictionaryentry.Value as NetworkLevel2Connection;
             networkmodelconnection.Tick();
         }
     }
     else
     {
         connectiontoserver.Tick();
     }
 }
Exemplo n.º 4
0
 public void Go(int port)
 {
     net = NetworkImplementationFactory.CreateNewInstance();
     net.ListenAsServer(port);
     net.ReceivedPacket += new Level1ReceivedPacketHandler(net_ReceivedPacket);
     while (true)
     {
         net.Tick();
         Thread.Sleep(50);
     }
 }