ok so iv made a sort of remote command operator. it is made of 2 sections the server and the client the client sends a command the server executes it and returns the output.
now for some resone i cant read all of the output i can only read a few lines then it just waits for the time out.
i send the output of the command like so "[CommandName:PID]:OneLineOfOutput\n" and then this repeats for each line that the command outputed
and then i try to read this line by line and when there isnt something to read i time out the reading process and wait for a new command to send to the server.
the kind of stuff its ment to output looks like this
[ListCmds:1232]:ListCmds:0
[ListCmds:1232]:Shutdown:1
[ListCmds:1232]:FullSysShutdown:2
[ListCmds:1232]:Restart:3
and this is what i see on the console
[ListCmds:1232]:ListCmds:0
[ListCmds:1232]:Shutdown:1
it just seems to skip 2 lines.
my reading thread code
private static void ReturnManager(Socket Soc)
{
using (StreamReader RS = new StreamReader(new NetworkStream(Soc)))
{
DateTime TMR = DateTime.Now;
while (true)
{
if (RS.Peek() > 0)
{
Console.WriteLine(RS.ReadLine());
TMR = DateTime.Now;
}
if (!Soc.Connected)
{
break;
}
if (DateTime.Now - TMR > TimeSpan.FromSeconds(LastReadTimeoutSeconds))
{
break;
}
Thread.Sleep(20);
}
}
Soc.Close();
Soc.Dispose();
}
now before you ask i did make sure all the data was beeing sent throu the socket on the serer side its just not beeing fully read by the client.
What I have tried:
i have tryed adding a wait timer to the start but that doesnt fix the problem it just makes it harder to happen.