TcpListener.EndAcceptTcpClient() throws when listener stopped? RRS feed

  • Question

  • Hi,

    Is the TcpListener.EndAcceptTcpClient() method written to throw an ObjectDisposedException when we call TcpListener.Stop() on the tcp listener instance...?

    I am a bundle of mistakes intertwined together with good intentions

    Tuesday, January 10, 2017 6:48 AM


  • Hi deostroll,

    I think it is not entirely correct. The key purpose of TcpListener.EndAcceptTcpClient is to asynchronously accept an incoming connection attempt and creates a new TcpClient to handle remote host communication.

    And, ObjectDisposedException is an exception handler, it will throw ObjectDisposedException if Stop() has been called. You could refer the source code of TcpListener.EndAcceptTcpClient.,22b34695e0cebf39

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    • Marked as answer by deostroll Wednesday, January 11, 2017 4:33 AM
    Tuesday, January 10, 2017 7:53 AM