Hmmmmmmm

Thought I would re-write my application since it was done entirely in 1 class file.. thought I would make it more OO and make it more maintainable than what it already was

The way my app works is:

Connect to destination
Recieve confirmation of connections (DataManager Class handles incoming comms)
Proceed with other stuff.

Now, when it is "receiving" data... it executes it in a different thread on its own.

New Class files created:

ConnectionManager (manages connections)
CommunicationManager (manages communication, outgoing and incoming)
IncomingDataManager (manages incoming data (decodes byte etc...))

I then have a main form from which the class(es) are instantiated.

Before having these 3 classes, it was all in 1 class file and worked fine

Problem I am having is that when the server sends a message back like "ok, your connected) .... the IncomingDataClass does not seem to "run", it instantiates it fine but when I put a breakpoint on the method that handles the incoming data, nothing happens.

When Recieving data in the new thread, it seems to go into that and execute. This is what my CommunicationManager class file has:

Code:
public void ListenToPort()
{
while (this.theConnectionManager.IsConnectedToServer)
{					
	if (this.theNetworkStream.DataAvailable)
	{
		byte[] theIncomingDataBuffer = new byte[this.theLengthOfBytesIncomingData];
		int theData = this.theNetworkStream.Read(theIncomingDataBuffer, 0, theIncomingDataBuffer.Length);
                         this.theDataManager.HandleIncomingData(theIncomingDataBuffer);

	}
	//Thread.Sleep(4);
}
}

The Incoming Data Manager is instantiated when the Communication Class has been instantiated (through constructor) and both seem to instantiate fine.

I do not understand why, when incoming data is arriving, the Recieve() OR data manager do not pick it or handle with it.

anyone have any ideas? perhaps you need more info?