views:

10

answers:

0

When I use the following code to send a query and recieve a response from a game server only some of the response gets loaded into my byte array. Im new to using udp and networking things like tcpip, can someone point me in the right direction so that I can get the full response (when i send the query using netcat i get the full response)

        byte[] data = new byte[1024];
        string stringData;

        UdpClient server = new UdpClient(currentIP, currentport);

        IPEndPoint send = new IPEndPoint(IPAddress.Any, 0);

        string query = "\\players\\";
        data = Encoding.ASCII.GetBytes(query);
        server.Send(data, data.Length);

        data = server.Receive(ref send);


        stringData = Encoding.ASCII.GetString(data, 0, data.Length);

        MessageBox.Show(stringData);