In an Azure-based web application, I want a client to be able to send a TCP packet to port 293 on my server and, in response, my web app should open up a socket for the client (and be able to send TCP back).
Does it work the same in Azure as it does in any C# server? Does the socket C# file go inside a web role or worker role? What classes can/should I use?
All help is appreciated!
Web Roles and Worker Roles are essentially Windows Server 2008 SP2/R2 with and without IIS running, respectively. As for code, do whatever you'd do in Windows Server to listen on a particular port.
A port maps to a specific role. So, if you have a Web role and create an input endpoint on port 293, then that traffic would be directed to your Web Role (and load-balanced across all instances). Likewise, if you set up the port on a Worker Role, the traffic would go to instances of the Worker Role.
If your socket listener is actually going to save data that's being uploaded, you need to make sure your saved data goes to durable storage - that is, to Windows Azure blobs or tables, or SQL Azure. If you write to a local disk (including disk local disk space allocated as a Local Resource), it's non-durable and you cannot count on data sticking around if something goes wrong (e.g. disk failure).
Related
I have been thinking of the best solution to query the data from remote machines with internet access but without public IP
I have a plenty of intel NUC machines and the AWS-based server machine. I have ASP.NET MVC application deployed on the server
User will open the particular page, press the button and then he needs to see the data from the remote intel NUC machine on the page.
My understanding is that I can use WCF duplex mode to access the clients from the server and have the windows service (WCF client) istalled on the client machine and communicating with the hardware. But the thing is that the hardware SDK gets data in chunks and the read time couuld be up to 20 seconds (200 chunks) for example, and I want the user to immediately see the data as soon as the subsequent chunks is ready. Not sure if WCF is the best
The second solution came into my mind is the following: by pressing the button the server will send the SignalR command to the client. After receiving the command the client will start fetching the data and send to the server using POST-request or whatever. Then the server will store the data in some in-memory storage such as Redis and the UI client will get the data and show.
Could you please advice? Am I crazy?
I have several machines running an application that plays a video feed from a camera. Each machine is located behind a firewall on different LANs. I am trying to investigate an approach to be able to talk to these machines from an Azure web app and get access to the video they are streaming. I don't want to have to open ports on any LAN. My first attempt at this was to have a client running on each machine that contacts an intermediate Azure service via a TCP port, the port is kept open and the local machine sends data to the Azure service which basically downloads this data and then sends it on to any connected clients.
The problem I am having is the intermediate service essentially has to download each message and then retransmit it to any clients, I don't think this approach will scale as the intermediate server can become overrun very easily. Ideally all I would like the intermediate service to do is manage the connections between the local machines and the end client azure service so that they talk directly to one and other.
I guess this must be similar to what products like TeamViewer or LogMeIn do.
I'd appreciate any pointers or suggestions from others experience.
I have a server application which monitors the clients' activities in the network (all codes are in C# winforms). The server application already has IP addresses of client computers. I want to know how to check
i) if the clients are online (i.e, have opened and been using the client applications) or offline (not using the applications)?
ii) if the clients' computers are opened?
I'm not good in networking and have not got it after searching for hours on internet. Please help!
Edited: I have seen the mentions of HTTP, TCP, UDP, etc. in various sites about server-client applications. What are the differences between them and which one should be used for the above?
PS: Sorry for extra questions. The questions are related so I dont want to make a new post.
You could check if the client machines are online by pinging each machines using their respective IP address.
Ping ping = new Ping();
PingReply pingReply = ping.Send("IP Address");
if(pingReply.Status == IPStatus.Success)
{
//Machine is online
}
To check if client machines are using any particular application(if
those application are built by you and have access to source code).
you can use WCF inter process communication. basically you will create
a WCF service method and host in a managed environment. to be specific
you could host this service in your server win form application. As
long as your win form application is running in the server client
application installed in individual machines can call this method to
send a status(including individual IP address of machines). so server
app would know who is running/opened the specific client application
in each machine.
If you want to check the status of any other client applications, say
you want to get the status to server whenever a client machine runs a
"xyz" application. then you need a create a application which runs on
individual client machines(Windows service would be best option). job
of this application would be to check the running processes
periodically to see if any specific application process is running. if
then it will invoke the WCF hosted in your server app to send the
status.
Several options are available, following is a conceptual answer
Your server can maintain available clients in some list. Here you can include Time to live for a specific client (Like session expiring). You client need to send periodical flags to server to indicate that Client is still using the service and when Server get this reply it can update it list's session so it won't be expire.
Note - The list can be a small data structure which include clients IP and Last flag recieved time. Your server then can go through this list and check for expiration of a client (lets say when time stamp is older than 2 minutes Server assumes client doesn't use the service/not online)
Also other option is your server can send client a flag and get reply back periodically.
Simple Client Server -
http://www.codeproject.com/Articles/12286/Simple-Client-server-Interactions-using-C [Simple guide]
http://csharp.net-informations.com/communications/csharp-multi-threaded-server-socket.htm [Multi threaded]
Short Verstion: I have a task that I need to make an application get a computer's camera screenshots, and send to another computer running a Windows Service, in the same local network (but not connected to the internet), along with some other information.
Long Explanation: We have an application that runs in the background while the user takes a survey, and we get the user's information such as ID and we save his answers along with other information (only pictures at the moment).
We convert these pictures to data and send them to a WebService, which then saves in a server.
Now we're implementing an "offline" version of this functionality, and we're supposed to save the user's data to a specific computer in the local area network, running another application that saves these data to later upload them to the server when it's online.
Question What do I need on both PCs for this communication to work?
Is it possible to access the Windows Service in the Host PC if it doesn't have IIS installed? (It'll be a client machine so it probably won't have it).
I've been trying to google to understand what should I search/understand but I couldn't find anything that wasn't about WCF and IIS / Online services.
you need some form of communication between the 2. It could be TCP/IP sockets or WCF or classic webservices... but if it is webservices then you DO need it hosted in IIS just like WCF. But WCF allows you to not only host it in IIS but it can be self hosting in your application or you can also use the Windows Activation Services (WAS) too. TCP/IP sockets can also be a solution here. I would lean towards TCP/IP Sockets as the problem you describe is more suited for this than a full bloated service.
This topic has been discussed million times before, but let me clarify my needs:
I need a single server which controls a system and includes the necessary functions. Furthermore, there will be "n" Clients which represents only the HI/GUI and call server side functions. The server itself should be able to send data back to the clients and call client-side functions too (like shutdown, exit and so on...)
I have heard about duplex services/contracts (http://msdn.microsoft.com/en-us/library/ms731064.aspx), but I'm not sure how far I'll come with that.
How would you handle this?
I recently made a proof of concept app that made both the server and the client host a WCF service each. The client connects to the server and then in a handshake call, gives the server the connection information to allow the server create a separate connection back to the client. It worked a treat with multiple clients on network links from local lan to 64k line on remote sites at the same time.
You could use WCF, and host the service on the server in IIS, in the application on the client and let the client register it's endpoint on the server.