You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need help. I have a remote component that transmits data to me via TCP through a port (GPS).
in my blazor server app
Program.cs -->
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSignalR();
var app = builder.Build();
app.MapHub("/current-time");
app.Run("http://*:5000");
MainBub.cs --->
using Microsoft.AspNetCore.SignalR;
public class MainHub : Hub
{
public async IAsyncEnumerable Streaming(CancellationToken cancellationToken)
{
while (true)
{
yield return DateTime.UtcNow ;
await Task.Delay(1000, cancellationToken);
}
}
}
To know if the server was working, create a client and with it it works fine
from client side --->
using Microsoft.AspNetCore.SignalR.Client;
public class MainClient
{
public static async Task ExecuteAsync()
{
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I need help. I have a remote component that transmits data to me via TCP through a port (GPS).
in my blazor server app
Program.cs -->
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSignalR();
var app = builder.Build();
app.MapHub("/current-time");
app.Run("http://*:5000");
MainBub.cs --->
using Microsoft.AspNetCore.SignalR;
public class MainHub : Hub
{
public async IAsyncEnumerable Streaming(CancellationToken cancellationToken)
{
while (true)
{
yield return DateTime.UtcNow ;
await Task.Delay(1000, cancellationToken);
}
}
}
To know if the server was working, create a client and with it it works fine
from client side --->
using Microsoft.AspNetCore.SignalR.Client;
public class MainClient
{
public static async Task ExecuteAsync()
{
var uri = "https://localhost:5000/current-time";
await using var connection = new HubConnectionBuilder().WithUrl(uri).Build();
await connection.StartAsync();
await foreach (var date in connection.StreamAsync("Streaming"))
{
Console.WriteLine(date);
}
}
}
But the remote component (GPS) doesn't connect to the server.
Remote component data (GPS)
Domain: XXX,XX.XXX.XXX
Port: 5000
Protocol: TCP
What am I doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions