|
-
Aug 12th, 2003, 07:01 AM
#1
Thread Starter
Addicted Member
Which Port Revisted!
Hello.
When writing socket programs which comunicate with eachother over IP, how do you choose which port they should use?

What happens when another process tries to use the same port?
Cheers!
Last edited by Justy; Aug 13th, 2003 at 08:24 AM.
-
Aug 13th, 2003, 06:31 AM
#2
Thread Starter
Addicted Member
No insights?
Is is ok to just randomly choose a port number?
-
Aug 13th, 2003, 06:36 AM
#3
KING BODWAD XXI
-
Aug 13th, 2003, 06:55 AM
#4
Retired VBF Adm1nistrator
For good proper redundancy you might try selecting a wide range of port numbers. So your app will listen on port 2000, 2100, 2200, 2250, 2260, 2270, 2280, 2290, 2295, 2300
Chances are at least one should be free. And when another app is trying to connect, if it doesn't receive the correct handshake protocol upon connect, then that's another app already running on that computer...
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 13th, 2003, 07:58 AM
#5
Thread Starter
Addicted Member
Thanks fellas...
-
Aug 13th, 2003, 08:23 AM
#6
Thread Starter
Addicted Member
OK I'm back..............
Right well the reason I was asking about ports is that I'm writing a windows service in VB.NET which accepts socket requests from client programs and verifies license information.
Sometimes, and only sometimes, I get the following error when trying to start the service:
"Only one usage of each socket address (protocol/network address/port) is normally permitted"
Now I've tried lots of different port numbers and this keeps happening now and again. Is it possible for a process to 'hold on' to a port after it has been stopped? Perhaps there is another reason for encountering this problem?
-
Aug 13th, 2003, 08:30 AM
#7
KING BODWAD XXI
-
Aug 13th, 2003, 09:23 AM
#8
Thread Starter
Addicted Member
Thing is.. it sometimes gives me this error messages even after I have just restarted the computer and run the service for the first time..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|