Sign in to follow this  
Followers 0
jchd

Selecting TCP ports numbers

7 posts in this topic

Hi all,

I'm currently considering a client/server version of SQLite with some bells and whistles.

I'm going to use TCP and I'd like to select several non-registered ports.

For now I've chosen:

Global Const $_TCPports = [0xFACE, 0xFADE, 0xFEED, 0xDEAF, 0xDEAD]    ; try these ports in order
;                            64206,  64222,  65261,  57007,  57005
 

Maybe it's childish to focus on trying words in hex but it seems a good way to remember them.

Which advice can admins give on this matter?

BTW I stumbled on this really shoking page, where Apple shamelessly claims nothing less than ALL non-registered ports 49152..65535 on both TCP and UDP. These guys do touch themselves at night.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites



For now I've chosen:

Global Const $_TCPports = [0xFACE, 0xFADE, 0xFEED, 0xDEAF, 0xDEAD]    ; try these ports in order

;                            64206,  64222,  65261,  57007,  57005

 

Maybe it's childish to focus on trying words in hex but it seems a good way to remember them.

 

Which advice can admins give on this matter?

A good place to have a base is: http://www.iana.org/assignments/port-numbers

nice: 0xFACE

JS


http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks, but when I say "non-registered" I mean "not registered by IANA". The range 49152.65535 is left free for private/temporary use and excluded from registration. I don't believe that even if this turns someday into a robust UDF we could afford to register port(s) officially!

EDIT: and to be somehow consistent with "words", the preferred port order should rather be:

[0xFACE, 0xFEED, 0xFADE, 0xDEAF, 0xDEAD]

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You should feel free to use any port which is not used for a well-known purpose. Really the only reason why you might not want to pick a port is if it's already taken on the systems you expect to deploy it to. For example, your software provides resilliency for web servers: Don't pick port 80. The ports in the 0-1023 range are the well known ports, but even more than half of them don't see much use nowadays.  Feel free to pick the unused ones.

The range of registered ports can be used for any purpose, but again look for their wide-spread use. Don't pick a port like 3478 because it's used for STUN/TURN and because these protocols almost always exclusively go over these ports (considering they deal with discoverability and therefore use a publicly known port), you may want to avoid it. But a port like 3605 which officially is "ComCam IO Port". You can ignore that registration.

Unless you truly are using the port range above 49152 as dynamic ports, don't. UDP and TCP both have a destination port (the port number you connect to) and a source port (randomly generated in the 49152 range). When anyone sees these ports, they assume that they are either randomly generated or part of another dialog (for example, torrent clients open a whole range of ports for other hosts to connect to, they use an existing connection to tell these hosts where to connect).

So my advice, for any purpose, pick a port somewhere between 1 and 45000 and check to see if they are not in much use today. And always make listening ports configurable because you can't please everyone.

Edited by Manadar

Share this post


Link to post
Share on other sites

Good. I'll keep away from dynamic range.

But then my fear is that by selecting more or less blindly some rarely used port(s) in the IANA range it/they could clash with some "higher priority" use. Having to reconfigure both server(s) and clients is a pain, even from .INI or such. If ever this thing works and gets solid enough to be used in practice, it's likely that a connection could be in use for some time. Locking a port which may need to be used anytime for other purpose is annoying at least.

Also and since AutoIt isn't multi-threaded, I don't see how I could decently manage multiple active connections to the same AutoIt server instance. DB operations (=> connections) can last for long time and the server won't be responsive enough in the meantime. That's why I prefer a single connection per instance paradigm, hence the need for as many ports as potentially active connections.

Of course it would fully make sense to instead use a faster multi-threaded server in C[++] or something, but I'd like to try an AutoIt-only design.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Definitely spin up multiple AutoIt processes. That will speed up the handling of the commands (because they run in parallel) and also lets you open multiple connections easily. You can even do like torrents where you have a single master socket where you receive short-lived commands, and to process them you spin up a new process with a listening port and tell the client to connect to that instead and disconnect from you. Your master socket can run on a relative unused port between 1024 and 45000 but your other processes are dynamic, so they should use ports in 49000+.

There are also ways to discover services from other clients. You can use SIP to establish a session (on port 5060) and then use SDP for service discovery. That's how VoIP does it, but SIP and SDP are definitely not exclusively for the purposes of VoIP. Maybe there exist some open/free tools to do this but maybe the SDP protocol isn't really ideal for your purpose.

Share this post


Link to post
Share on other sites

Fine. Thanks for your advices.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0