Advertisement
Guest User

Untitled

a guest
Oct 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1.         void cocks()
  2.         {
  3.             NetworkStream stream = null;
  4.             try{
  5.                 stream = YOUR_TCPCLIENT_HANDLE.GetStream()
  6.                 //all of your code here
  7.             }catch(Exception ex){
  8.                 //exception raised
  9.                 //handle/print how you'd like to with ex.message and ex.innerexception
  10.             }finally{
  11.                 //we close all streams regardless of code execution
  12.                 if(!YOUR_TCPCLIENT_HANDLE.Equals(null)) YOUR_TCPCLIENT_HANDLE.close();
  13.                 if(!stream.Equals(null)) stream.Close();
  14.             }
  15.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement