Who assigns the port number to the processes

The Internet Assigned Numbers Authority (IANA) has assigned port number 2638 to the SQL Anywhere database server for TCP / IP communication. However, other applications are not prohibited from using this reserved port, and doing so could cause an address collision between the database server and another application.

If you specify the ServerPort Protocol (PORT) option, only the specified port number is used for TCP / IP connections and UDP broadcasts. If you do not specify the ServerPort protocol option, port 2638 is used. Applications can connect to the database server without specifying a port number. If port 2638 is available, SQL Anywhere clients can find SQL Anywhere database servers running on different subnets and behind firewalls.

The server then waits on the same UDP port as the TCP / IP port. The database server monitors UDP ports and responds to requests to those ports so clients can locate the database server by server name.

If you are using a web server, by default the database server listens for requests on standard HTTP and HTTPS ports 80 and 443.

UDP packets sent by the database server in response to client broadcasts do not contain sensitive data. The data in these packages is limited to the following information:

  • Database server name
  • Port number
  • Database server version
  • Names of the databases running on the database server

You can hide database names from broadcast requests by using the -dh option. You can also specify -sb 0 to turn off the UDP listeners completely.

Differences in Mac OS X

Mac OS X does not allow multiple processes to bind the same UDP port. If a database server runs on one of these platforms, it only waits on the specified UDP port or port 2638 if no port is specified.

This means that clients must provide the TCP / IP port number if the database server is not using the default port (2638).

For example, if the database server is started with the command, a client on the same subnet can find the server with the connection parameters. If another server on Mac OS X is started with the command, a client on the same subnet can find the server with the connection parameters. Note that if the database server is running on a platform other than Mac OS X, the client does not need to supply the PORT parameter.

In addition, if a SQL Anywhere database server is already using port 2638 on Mac OS X and a second database server is started without the PORT protocol option, the second database server will fail to start. Hence, users need to know the server's port number and specify it in their connection parameters. Personal servers start successfully even when port 2638 is in use because shared memory is commonly used to connect to personal servers.