Closed this
Thanks for the feedback and seems i found where was the problemwas calling endinvoke inside ProcederAceitar i just changed it and now call it's after result where begininvoke is called:Quote:
This code has so many flaws.
- Never run logic in a catch
- NEVER RUN ASNYC CODE IN A CATCH
- Never let a catch empty
- Use while instead of goto-loops
- Remove unnecessary code
- Use english as your coding language
- Use SOLID principle
- Use clean code
This code is unreadable.
if (OnAceitar != null)
{
IAsyncResult result;
Console.WriteLine("OnAceitar != null client: {0} Handle: {1}", handler.RemoteEndPoint, handler.Handle);
result = OnAceitar.BeginInvoke(client, new AsyncCallback(ProcederAceitar), client);
OnAceitar.EndInvoke(result);
Console.WriteLine("iAsyncResult OnAceitar.BeginInvoke: " + result.AsyncState);
}
private void ProcederAceitar(IAsyncResult ar)
{
if (Fexando)
{
Console.WriteLine("ProcederAceitar Fexando igual a true");
return;
}
//OnAceitar.EndInvoke(ar);
I gotta disagree with you here, especially when handling procedures that will always throw off an error and you simply want to catch it and nothing moreQuote:
- Never let a catch empty