Search code examples
androidsql-servertcpconnectiondatabase-connection

Need help understanding what these values are with a database connection


I need help understanding what these values mean in order to do proper research.

I'm build an android app that connects to a local server, performs a query and sends back the data to be displayed. I'm using jtds1.3.1 to connect.

The query is performed like this. A connection is opened to the database, query performed, results sent back then the connection is closed. Sometimes multiple searches are done and that process occurs each time.

The one thing I noticed though and is what I need clarification on are the values that are displayed in the console window.

[socket][0] connection /SERVERS IP ADDRESS:1433;LocalPort=-1(0)
[socket][/SERVERS IP ADDRESS:49778]
close [socket] [/SERVERS IP ADDRESS:49778]

what is the 49778? Each time a new connection is opened that number increases by 2. Is there a limit on how high that can go?

The socket number is also increasing by 1 each time.

There are other PC's that access this server for the front end portion to get data. Are they adding to the increasing 49778 number as well?


Solution

  • THe 1433 is the TCP port number for the mysql server.

    The 49778 is the current "ephemeral", dynamic TCP port number of the client. Together they form a socket they can communicate over.

    Ephemeral ports start at 49152, count up to 65535 (some systems randomize ports), then start over.