LiveOrDevTrying / Tcp.NET

Tcp.NET provides an easy-to-use and customizable Tcp Server and Tcp Client. The server is created using a TcpListener. The server and client can be used for non-SSL or SSL connections and authentication (including client and server ssl certification validation) is provided for identifying the clients connected to your server. Both client and server are created in .NET Standard and use async await functionality.
Apache License 2.0
42 stars 10 forks source link

Disconnect Event not being shown #6

Closed gkapellmann closed 1 year ago

gkapellmann commented 1 year ago

Hi,

I got a server running, and works nice, when i connect two separate clients the Connected event fires. image

But when I Diconnect one, or both, no Disconnect event or Errir event happens. Disconnect event only happens if I disconnect from the server.

Is this expected behaviour? Or Should Disconnect or Error event fire also when any client disconnects?

filip-martinko commented 1 year ago

I have the same issue. I have TCP Server in C++. TcpNETClient is not notified if the Server disconnects this client. The client will find out it lost the connection to the server after it tries to send some data to the server. But I would like to be informed as soon as possible because the Client sends data to the server rarely...

LiveOrDevTrying commented 1 year ago

Hello,

I've implemented a new feature that sends a byte[] {3} (or whatever byte array specified) from client to server and server to client to fire disconnect events when the server or client performs a graceful Disconnect(). The code has been commit and packages pushed to nuget.

Give it a try and let me know if you have any problems, thoughts, or additional feedback. Thanks!