« How to Avoid Economic… | Home | EmailMessage trouble »

Using ServerSocket with a system chosen port


Something I learned today: If you offer an service in your application and you announce it on the network using Bonjour, you can pass a port number. But you don't need to ask the user for a port number or hard code one. You can simply let the operation system pick a port for you:

ServerSocket1.Port = 0
ServerSocket1.Listen
MsgBox str(ServerSocket1.Port)

So you specified 0, you started the socket and now you can read what port you got. If you announce this port now on Bonjour using our DNSServiceRegisterMBS class, your clients will easily find you.
05 05 10 - 23:14
No comments

  
Remember personal info?

Emoticons / Textile


Notify:
Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.