Guest User

Untitled

a guest
Jun 22nd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. //This might throw an exception
  2. sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  3. sock.Connect(ip, port);
  4.  
  5. //Try statement
  6. try
  7. {
  8. sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  9. sock.Connect(ip, port);
  10. catch
  11. {
  12. }
  13.  
  14. //using(){}
  15. using(sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  16. {
  17. sock.Connect(ip, port);
  18. }
  19.  
  20. IDisposable d; try { d = m; } finally { d.Dispose(); }
Add Comment
Please, Sign In to add comment