OK, so i've written a server to listen to TCP connections, and send a response. It can be connected to via telnet and works fine.
Next, i started writing the client side of the application - I started out simple by trying the following:
public static void Send2(Server server)
{
TcpClient client = new TcpClient();
client.Connect(server.HostName, server.Port);
NetworkStream clientStream = client.GetStream();
byte[] data = Encoding.ASCII.GetBytes("Testing 123...");
clientStream.Write(data, 0, data.Length);
}
If i call it with:
Server server = new Server("127.0.0.1", 15000);
for (int i = 0; i <= 50; i++)
{
TcpSender.Send2(server);
}
It should send "Testing 123..." 50 times, but only shows up on the server a few times (2-10, varies every time).
I'm assuming the client code is at fault, as telnet clients work with the server fine.
Is there anything that would cause this in the code above?
If it's fine - please say so and I will post my server code,
Thanks in advance!