开发者

Windows Azure Sockets

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:

  1. 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).
  2. Create and handle the Run event, in this Run method add a listener.
  3. Capture the BeginAcceptSocket event (or BeginAcceptTCPClient if you like)
  4. In the call back function of BeginAcceptSocket event, add a handler for BeginReceive event.
  5. In the call back of BeginReceive event, you can add any code to manipulate the message from client.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜