Shane
Shane

Reputation: 119

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:

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?

Upvotes: 3

Views: 4106

Answers (2)

Zsolt
Zsolt

Reputation: 2501

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)?

Upvotes: 3

scartag
scartag

Reputation: 17680

if your "messages" are mostly textual, you may want to take a look at SignalR.

SignalR is a new library for asp.net to enable real-time web functionality.

It uses websockets (or long polling if websockets is unavailable at server/client).

It has support for different client types.

Upvotes: 2

Related Questions