K
Kumar
I am using granados telnet client for connecting to the telnet and get the
data from it. Every thing appears to be going smooth. But for some reason
when I try to write the byte data to a string or streamwriter, it looses the
final packet. Strangely, If I output the datapackets to a console from the
telnet server, it perfectly gets all the output packets.
the code snippet is below:
StreamWriter sw = new StreamWriter("c:\\output.txt", true);
public void OnData(byte[] data, int offset, int length)
{
System.Console.Write(Encoding.ASCII.GetString(data, offset,
length));
outputdata = (Encoding.ASCII.GetString(data, offset, length));
sw.Write(outputdata);
//sw.Close();
}
in the above,
System.Console.Write(Encoding.ASCII.GetString(data, offset, length));
outputs the data correctly, however,
in the outputdata string the last packets gets chopped off.
Can someone help me understand what's happening behind. Or is it something I
am missing while writing to a string or file.
data from it. Every thing appears to be going smooth. But for some reason
when I try to write the byte data to a string or streamwriter, it looses the
final packet. Strangely, If I output the datapackets to a console from the
telnet server, it perfectly gets all the output packets.
the code snippet is below:
StreamWriter sw = new StreamWriter("c:\\output.txt", true);
public void OnData(byte[] data, int offset, int length)
{
System.Console.Write(Encoding.ASCII.GetString(data, offset,
length));
outputdata = (Encoding.ASCII.GetString(data, offset, length));
sw.Write(outputdata);
//sw.Close();
}
in the above,
System.Console.Write(Encoding.ASCII.GetString(data, offset, length));
outputs the data correctly, however,
in the outputdata string the last packets gets chopped off.
Can someone help me understand what's happening behind. Or is it something I
am missing while writing to a string or file.