Skip to content

Tidtelnet.Disconnect cannot be disconnected #608

Closed Answered by rlebeau
lzplzp001 asked this question in Q&A
Discussion options

You must be logged in to vote

DisconnectNotifyPeer() is intentionally empty at the TCP level. It is a virtual method, various protocol-specific descendants override it when they need to send messages to peers while closing connections. But there is nothing in the Telnet protocol to notify a peer about when closing the connection, which is why TIdTelnet does not override DisconnectNotifyPeer(). TIdTelnet overrides Disconnect() itself instead, to shut down its internal reading thread while closing the connection.

Typically, the only way that Connect() would think the socket is already connected after a Disconnect() is if there is unread data left behind in the IOHandler's InputBuffer. Even though the physical socket has…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by rlebeau
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Element: TCP Issues related to TCP handling, TIdTCPClient and TIdTCPServer descendants, etc Element: Telnet Issues related to TIdTelnet and TIdTelnetServer
2 participants
Converted from issue

This discussion was converted from issue #524 on February 14, 2025 22:47.