Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. public bool BlockPort(int portToBlock)
  2. {
  3. try
  4. {
  5. Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);
  6. IPEndPoint ep = new IPEndPoint(IPAddress.Loopback, portToBlock);
  7. s.Bind(ep);
  8. portSocketDictionary.Add(portToBlock, s);
  9. }
  10. catch (Exception e)
  11. {
  12. Console.WriteLine(e.Message);
  13. return false;
  14. }
  15. return true;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement