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