Pavol

Pavol

  • NA
  • 23
  • 9k

Unblockd IpEndPoint

Jul 25 2013 7:31 AM
Hi
I have got following code:
public void listen()
        {
          
            client = new UdpClient(localPort);
            host = new IPEndPoint(IPAddress.Any, 0);
           
         
            while (Convert.ToString(client.Available)!="")
            {
        
                received = client.Receive(ref host);     //error on this line !!!!!!!!!!!
                receivedString = Encoding.ASCII.GetString(received);    
                writer = new StreamWriter(pathDesktop + @"\CLO_Log.txt", true);
                writer.Write(receivedString);
                writer.Close();
                tb.Invoke((MethodInvoker)delegate()
                {
                    tb.AppendText(receivedString);
                });
            }
          
            client.Close();
        }

I start this method on thread.
In form i have got code:
thread.suspend();
some code
thread.start();

Error message is "A blocking operation was interrupted by a call to WSACancelBlockingCall"