public void ServerUdpClientSend() { //--------------------------------------------------------------------- //Setup //--------------------------------------------------------------------- UDP_Config config; config.address = "127.0.0.1"; config.port = 4486; IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 4485); ServerListenerUDP listener = new ServerListenerUDP(config); DotNetserialization serializer = new DotNetserialization(); ServerLibrary.UDPClient client = new ServerLibrary.UDPClient("Tester"); client.AddSerializer(serializer); client.AddEndPoint(endPoint); client.AddListener(listener); ChatMessagePacket packet = new ChatMessagePacket("This is a test", "Tester"); //--------------------------------------------------------------------- //Run Test //--------------------------------------------------------------------- client.Send(packet); //--------------------------------------------------------------------- //Gather Output //--------------------------------------------------------------------- //--------------------------------------------------------------------- //Assert //--------------------------------------------------------------------- }
//----------------------------------------------------------------------------------------- private void CreateNewUdpClient(string username, IPEndPoint endPoint) { UDPClient client = new UDPClient(username); client.AddSerializer(_serializer); client.AddEndPoint(endPoint); client.AddListener(_listener); client.Start(); _clientList.Add(client); Console.WriteLine("Client Connected!!!"); }
public void ServerUdpClientAddDotNetSerializer() { //--------------------------------------------------------------------- //Setup //--------------------------------------------------------------------- ServerLibrary.UDPClient client = new ServerLibrary.UDPClient("Tester"); DotNetserialization serializer = new DotNetserialization(); //--------------------------------------------------------------------- //Run Test //--------------------------------------------------------------------- client.AddSerializer(serializer); //--------------------------------------------------------------------- //Gather Output //--------------------------------------------------------------------- //--------------------------------------------------------------------- //Assert //--------------------------------------------------------------------- }