question

MarkusFreitag-0088 avatar image
0 Votes"
MarkusFreitag-0088 asked TimonYang-MSFT commented

TcpClient - TcpListener - concept

Hello,
106742-concept-01.png


I have a server and a client. The client can send several requests, the server buffers these requests and processes them step by step.
I'm looking for a good simple code and concept.

Important:
106658-concept-01-event.png


The server can send an event to the client at any time.


The messages can be complete, split or incomplete. End of element missing, then timeout message.
106659-concept-01-message.png

I know a lot of questions and it is difficult. I thank you for your support and help.


dotnet-csharp
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Could it be useful to use WCF instead of TcpClient/TcpListener?
What Is Windows Communication Foundation

1 Vote 1 ·

I also suggest to give a look to gRPC
There is also an article from Microsoft

It seems that in the next future WCF will be replaced by gRPC.


1 Vote 1 ·
AgaveJoe avatar image AgaveJoe GaetanoSblendorio-2196 ·

gRPC requires HTTP 2 which I don't think is an option. WCF uses SOAP which is probably not an option either. The main issue is the OP needs to design a protocol to read the custom messages from a buffer. If the message is always <root>...</root> Then it's possible to write a custom parser to find the root node in the buffer (byte array). Then read from index 0 to the ending > in </root>. It would be much easier if the client sent the byte count with the message or a symbol that denotes the end of a message.

1 Vote 1 ·
Show more comments

Could it be useful to use WCF instead of TcpClient/TcpListener?


I need a socket connection with TCPClient and TCPListener.

0 Votes 0 ·

0 Answers