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

API interface required #9

Closed 604980670 closed 6 months ago

604980670 commented 6 months ago

Is there an API interface for the client to wait for the verification to be completed to send the message, I want to send it as soon as the connection is completed.

LiveOrDevTrying commented 6 months ago

Should be handled by the package. Make sure to await ConnectAsync() - If there is an auth token, it will be delivered as first message and digested, and / or if no auth token is passed, then method should wait for ConnectionEvent Connected, then complete async method. Then when you await SendMessage(), your messages will be delivered. If this doesn't work right, I can add a queue, but this would not be ideal - messages sent in a disconnected state (e.g. connection method / send message running in parallel) should be discarded I believe. Let me confirm.

LiveOrDevTrying commented 6 months ago

You should be able to await ConnectAsync() and when completed, messages sent with await SendAsync() should be sent. No queue required for this. Please confirm - if I am wrong I will post a fix.

604980670 commented 6 months ago

Send immediately after connection, and a verification failure will be reported. You must wait until the verification is successful before sending,

604980670 commented 6 months ago

I want to have a waiting interface to avoid sending failures

LiveOrDevTrying commented 6 months ago

Yes exactly - try await ConnectAsync(). I believe this is what you want. Let me know how it goes.

604980670 commented 6 months ago

thanks

LiveOrDevTrying commented 6 months ago

Check out the latest package and let me know how it goes plz.

LiveOrDevTrying commented 6 months ago

@604980670 .

Has this been resolved? If yes, I can close this issue.

Thanks, Rob