locked
StreamSocketListener ConnectionReceiveEvent

    Question

  • Hi,

    Is there a way that i can stop receive ConnectionReceived events after bind without close the listener, and then resume receiving events.My first thought was to remove the event handler, and then add it again but this approach couldn't work as seems we cannot change the handler after Bind it's called.

    Any ideas are welcomed

    Regards,

    Jose

    Wednesday, June 20, 2012 1:19 PM

All replies

  • Without knowing what you want to achieve, I'm not sure that's a good idea. If you're keeping the port open you're expected to react on incoming connections. Otherwise there's a chance you'll tarpit the other side, but I'm not sure how the API would handle that.
    Thursday, June 21, 2012 8:58 AM
  • I want to put the server on hold for a period of time, when it is in this state the server doesn't accept new connections, i also want  to avoid to have a custom queue with the Connections that my program has received but has not yet time to deal with.

    Usually a program  using TCP Sockets will use TCP backlog to limit the rate at which a server can accept new TCP connections, the program doesn't needs to handle connections as soon as are received, the OS will queue the connections and the program will call accept when is ready to handle a new connection.

    Friday, June 22, 2012 2:13 PM