1
0

ClientAcceptedEventArgs.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Net.Sockets;
  3. namespace OSHttpServer
  4. {
  5. /// <summary>
  6. /// Invoked when a client have been accepted by the <see cref="OSHttpListener"/>
  7. /// </summary>
  8. /// <remarks>
  9. /// Can be used to revoke incoming connections
  10. /// </remarks>
  11. public class ClientAcceptedEventArgs : EventArgs
  12. {
  13. private readonly Socket _socket;
  14. private bool _revoke;
  15. /// <summary>
  16. /// Initializes a new instance of the <see cref="ClientAcceptedEventArgs"/> class.
  17. /// </summary>
  18. /// <param name="socket">The socket.</param>
  19. public ClientAcceptedEventArgs(Socket socket)
  20. {
  21. _socket = socket;
  22. }
  23. /// <summary>
  24. /// Accepted socket.
  25. /// </summary>
  26. public Socket Socket
  27. {
  28. get { return _socket; }
  29. }
  30. /// <summary>
  31. /// Client should be revoked.
  32. /// </summary>
  33. public bool Revoked
  34. {
  35. get { return _revoke; }
  36. }
  37. /// <summary>
  38. /// Client may not be handled.
  39. /// </summary>
  40. public void Revoke()
  41. {
  42. _revoke = true;
  43. }
  44. }
  45. }