Hello, I am attempting to write a Remote Assistance program.
I am trying to debug my program to see what the image is not being displayed on the 'server'.
Server = Sends Screen Shots of User's Screen
Client = Receives Screen Shots and Displays them in a Picture Box
I am trying to place a break point on the ProcessData() line but it is not breaking on it. I don't believe any data is being passed as the paremeter for ProcessData (hence the empty image).
Here is the code to read data.
I believe byteList is empty when passed to ProcessData after the second internal while loop.Code:private void DoListen()
{
// Buffer for reading data
Byte[] bytes = new Byte[256];
List<Byte> byteList = new List<byte>();
String data = null;
// Enter the listening loop.
while (remainActive && client == null)
{
Debug.WriteLine("Waiting for a connection... ");
// Perform a blocking call to accept requests.
// You could also user server.AcceptSocket() here.
client = server.AcceptTcpClient();
Debug.WriteLine("Connected!");
data = null;
// Get a stream object for reading and writing
stream = client.GetStream();
int i = 0;
// Loop to receive all the data sent by the client.
while ((i = stream.Read(bytes, 0, bytes.Length)) != 0)
{
// Translate data bytes to a ASCII string.
//data += System.Text.Encoding.ASCII.GetString(bytes, 0, i);
byteList.AddRange(bytes);
Debug.WriteLine("Received: {0}", data);
}
ProcessData(byteList.ToArray());
// Shutdown and end connection
client.Close();
//remainActive = false;
}
}
What's wrong?
