Reputation: 3124
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!
Upvotes: 1
Views: 2122
Reputation: 71121
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).
Upvotes: 1