Is it possible to connect to remote TCP sockets using windows azure cloud? I've read it's only possible to receive on port 80 and开发者_运维问答 443.
Long ago, there were limits with Web roles. Not any more. When you set up your Role (your Virtual Machine), whether Web Role (meaning it's running IIS) or Worker Role (meaning it's not running IIS), you can expose endpoints with tcp, http, and https. You choose the port number.
You can open up to 25 endpoints in a given deployment.
With any type of Windows Azure role, you can define tcp endpoints and assign a specific port to each endpoint. You can then start a ServiceHost that listens on that tcp endpoint.The Windows Azure load balancer would take care of sending requests across your instances.
Azure allows only incoming ports 80 and 443 and you can use throw the WebRole. The worker role cannot listen to incoming messages from outside Azure.
Please try as follows:
- Create Azure Cloud service, in this service create Worker Role add an endpoint and choose your any port (You can also use Service Actor of Service Fabric).
- Create and handle the Run event, in this Run method add a listener.
- Capture the BeginAcceptSocket event (or BeginAcceptTCPClient if you like)
- In the call back function of BeginAcceptSocket event, add a handler for BeginReceive event.
- In the call back of BeginReceive event, you can add any code to manipulate the message from client.
精彩评论