Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET & TCP Server Solution

My server has two applications running on it:

  1. TCP socket server that continuously accepts and sends messages to and from clients (C# .NET Winforms)
  2. ASP.NET application

What I need is:

  • When a message is received from a client via the TCP connection (app 1) I want the ASP .NET application (app 2) to reflect this data dynamically. I realise that I can set database entries via the TCP socket, which will then be picked up by the ASP.NET application.
  • A way of sending messages to clients from the ASP .NET application to clients that are available inside of the TCP socket server

e.g. A simple chat program where a client sends “Hi” and server responds “Welcome”. The ASP .NET should show a log of this conversation as it happens. Immediately. And if I click a button on the ASP application, it should send a message on behalf of the socket server to the client “You have been accepted onto the server”

For the most part, the messages are going to be fairly short like the ones shown here.

What is the best way to do A and B?

like image 949
Shane Avatar asked Dec 08 '25 21:12

Shane


1 Answers

SignlaR is a good solution if you're getting the messages from another SignalR client (web page).

But what if these messages are being sent from a 3rd system over TCP/IP? Then you need to open a TCP port in the ASP.NET Web Application and after receiving a message you have to push it to the web clients.

But the question is, what is the best way to have such a TCP Listener hosted in a Web Application (ASP.NET)?

like image 107
Zsolt Avatar answered Dec 10 '25 12:12

Zsolt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!