0

SO Members,

Let me breakthrough the steps:- 1 ) I have created the TCP Listener in the separate Class that is started. This class will look for possible clients to connect to it.

2 ) I have created a TCP client in another Class that will POST the data in the TCP LISTENER stream. i.e., Will create a webrequest to the TCP listener HTTP URL and start posting the data in the stream i.e., using (var stream = HTTPWebrequest.GetRequestStream()) and starts writing using stream variable.

  1. Then, I have created a another TCP client that connects to the TCP lister in the get mode using webrequest , and webresponse in the 'GET' mode. This stream will fetch the stream by StreamReader reader = new StreamReader(HTTPWEBRESPONSE.GetResponseStream())

But, The Client that POST the data does not start before client that GET the data . so after step 3 , StreamReader reader = new StreamReader(HTTPWEBRESPONSE.GetResponseStream()) reader.endofStream times out (while debugging and quits without exception and jumps off from that series of code forever) because the data is not yet available in the stream.

Is there a solution to accomplish this approach. Is there any other way to achieve this approach for tcplistener process1 , HTTPWEBREQUEST process2 , HTTPWEBRESPONSE process3 .

Thanks in Advance !!

Dheena
  • 23
  • 4
  • It sounds like your use case would be a better fit for some kind of message buss or queue. – JonasH Feb 17 '22 at 14:35
  • @JonasH Can you please share some sample code or concept page\doc to explore in internet – Dheena Feb 17 '22 at 15:05
  • [Message Queue vs Message Bus](https://stackoverflow.com/questions/7793927/message-queue-vs-message-bus-what-are-the-differences) looks like it provides a decent overview of the topic. – JonasH Feb 17 '22 at 15:11
  • @JonasH, Thanks a lot, But isn't it possible to use the TCP concept for this. – Dheena Feb 17 '22 at 15:34
  • You can build whatever you want on top of TCP, but you might need to build it yourself. Using higher level protocols give up some control, in exchange complete and well tested solution. I would propose starting with a high level solution that is easy to get started with, and only move to lower level solutions when needed. – JonasH Feb 17 '22 at 16:20
  • @JonasH Alright, Thanks a lot. Will work in that perspective – Dheena Feb 17 '22 at 16:25

0 Answers0