Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. catch (SocketException se)
  2. {
  3. //Console.WriteLine("SocketException : {0}", se.ToString());
  4. //Console.WriteLine("Codice errore numero:" + se.ErrorCode);
  5.  
  6. if ((SocketError)se.ErrorCode == SocketError.ConnectionAborted)
  7. {
  8. //Console.WriteLine("SocketException GESTITA: CONNECTION ABORTED HANDLED");
  9.  
  10. if (listenerString != null)
  11. {
  12. listenerString.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
  13. }
  14. return;
  15.  
  16. }
  17. if ((SocketError)se.ErrorCode == SocketError.AddressAlreadyInUse)
  18. {
  19. Console.WriteLine("ERRORE:AddressAlreadyInUse");
  20. //MessageBoxResult retry = System.Windows.MessageBox.Show("AddressAlreadyInUse: click ok to try again.", "Errore");
  21. listenerString.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
  22. ThreadStart ThreadStringa = delegate()
  23. {
  24. this.RiceviStringa(new DelegateStringCopy(CopyToClipboard));
  25. };
  26.  
  27. fileThread = new Thread(ThreadStringa);
  28. fileThread.Start();
  29. }
  30. if ((SocketError)se.ErrorCode == SocketError.ConnectionReset)
  31. {
  32. Console.WriteLine("ERRORE:ConnectionReset Handled");
  33.  
  34. //MessageBoxResult retry = System.Windows.MessageBox.Show("AddressAlreadyInUse: click ok to try again.", "Errore");
  35. listenerString.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
  36. ThreadStart ThreadString = delegate()
  37. {
  38. this.RiceviStringa(new DelegateStringCopy(CopyToClipboard));
  39. };
  40.  
  41. fileThread = new Thread(ThreadString);
  42. fileThread.Start();
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement