I do start a thread after the socket has been connected
in the following simplified code from my socket class
public delegate void LoginAcceptedHandler(object sender);
public event LoginAcceptedHandler OnLoginAccepted;
public void Connect()
{
... socket initialization code here
_socket.Connect
Thread threadProcessServerData = new Thread(new
ThreadStart(ProcessServerData));
threadProcessServerData.Start();
}
//handler reading the datastream coming from the server
private void ProcessServerData()
{
byte[] data;
while (true)
{
data = ReceiveVarData(_socket);
if (data.Length == 0)
break;
... some switch case statements here
case ServerMessages.LoginOK:
OnLoginAccepted (this);
break;
}
Ok,
I have a form which has in instance of my socket client class.
It subscribes to its events.
When click a button on my form I send a socket message to some server which
then responds back to the client.  I get stuck here.  I have a thread in my
socket class already, where else should I create a thread?
I don't want thread all over the place everytime I received and event from
my socket client class.  So what am I doing wrong?
	
		
			
				Chris Tacke said:
			
		
	
	
		
		
			You're using a synchronous blocking call on the UI thread.  Move it to a
worker thread.
-Chris
Hi,
I am pressing on a buttom which performs some action and waits for an
event.
When I mouse the mouse around the screen while waiting, all events stop
firing.
I can't click on other buttons and have to forcefully shut down my
application.
Has anyone had this problem?  Any ideas on how to fix it?
Thanks,
Herb