Server/Client Connection - networking

Concerning Server/Client connection :
.Net socket server CAN communicate with .Net socket Client such as:
the desktop application developed in VS.net (Server listening in .net Web sockets)
enter code here
TcpListener Server= new TcpListener("127.0.0.1", 8000);
. . .
Server.Start()
Works perfect and listens to connections coming from clients
Unity3d Server CAN communicate perfectly with Unity Client as well.
but a desktop application using Websockets (Such in the upper example) doesn't listen/communicate with connections coming from Unity3d client such:
enter code here
client = new NetworkClient();
client.RegisterHandler(MsgType.Connect, OnClientConnect);
client.Connect("127.0.0.1", 8000);
any suggestions?

Related

SignalR server to server communications

I have an application that uses SignalR to broadcast data to all connected clients. Its a .NET6 Blazor Wasm hosted web application. Now, I want the the broadcaster (which is running on the Blazor server) to connect to a data source that is outside my website, and get data from there. The source data is being broadcast via UDP on a different network.
So my question is, is it possible that my SignalR hub that is running on the Blazor server connects to another SignalR hub running on a different machine in a different network and get real time data from it? Or may be I can run a SignalR client as well on my Blazor server and then connect to a machine on another network? Can I run a SignalR hub on the UDP source machine to which my Blazor server SignalR hub or client can connect? From what I have read, SignalR only runs on a website. Or is it that SignalR is not suitable for this kind of server to server data feeds?

Where does a webservice request from a Blazor Server app originate?

If I have a blazor server app hosted on a server (Server A) and a client is accessing that server from another device (Client A).
If the Blazor server app is calling a webservice via a System.Net.Http.HttpClient call that is hosted on another server (Server B). Will the request originate from the client device (Client A) or the server hosting the Blazor server app (Server A)?
This has implications for network access requirements as Client may not have access to the webservice hosted on Server B but Server A does?
With Blazor Server, all c# code is executed on the server, including your web request with System.Net.Http.HttpClient.
This differs from Blazor WASM which runs entirely on the client (after the initial request to Server A for the app).

SignalR connection pooling

I have 2 separate ASP.Net sites, one is outward facing serving the UI and the other is a backend API that is only ever accessed by the UI server.
We are using SignalR to push events through the client but these events originate on the backend API so there is a SignalR connection from browser -> UI Server and another from UI Server -> Backend API.
Currently each client that connects SignalR from the browser causing a new connection to be made to the backend API. This means that we have a lot of connections for the same hubs through between the same processes.
Is there any way in SignalR to have it pool the connections so they use the same underlying sockets while hiding that abstraction from my code in the SignalR .Net Client?

How to use a client websocket to connect to a remote websocket windows server

Help needed please
What's is the best WebSocket client library for a .net 4.5 on windows web application hosted on windows 2008 servers to connect to a remote server web socket.
The scenario is: our web application will use a web socket to connect to a server WebSocket on a third party infrastructure. Our client WebSocket will connect and send some commands and read the responses where we can identify the information needed. So there is no interaction from the user or browser its just in the code. e.g. user clicks a button and we go and get some data, and give a message dependant on the response.
so for example our client will connect to the third party socket and pass the users car registration number and send a tell me the car details and the server socket will return the data like: make, model, year etc... so we can then display that to the user.
Has anyone used this library with some good success? http://www.nuget.org/packages/WebSocket4Net
I'm hoping someone here can provide the best approach for doing this with some tried and tested solutions. I have been thinking about a web API that handles all the socket stuff in our client so i can call it and let it handle the close connection etc.

How can I use SignalR Hubs / Proxies without SignalR connection?

Here is my situation:
I have a 4-tier web application consisting of browser, web server, application servers and database.
Browser and application server should communicate in a RPC-style way.
The backend will run on windows machines, so I will use IIS as web server The application needs real time communication between application server and browser.
I want to use a SignalR connection for the communication between browser and web server. For the communication between web server and application server's I want to use a plain TCP connection.
I think this approach will enable me to send JSON messages between browser and application servers. But how can I realize a RPC communication?
Can I write a SignalR Hub, generate a JS proxy and bind the Hub to a TCP socket?
Here is a picture: https://www.dropbox.com/s/xeaja4dos4bgvbz/SignalR_Hubs_Stackoverflow.png
Nope. SignalR is based on HTTP not TCP directly. WebSockets is the closest thing to a raw tcp socket and it has the added benefit that it works over port 80.

Resources