Using ServerSocket with a system chosen port
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.