RMI: who opens the data port first? client or server?
posted 12 years ago
I've developed an application that uses a client application and a server application that communicate through RMI. Many of us know that with RMI, the port you specify is only used to establish the initial connection, and that a seperate port (chosen at random) is then used to send data (ie - objects, variables) back and forth between the server and client.
Due to firewall issues, I could not rely on this random chosen port. I had to fix this port to a certain value. To do this, I had to implement the RMISocketFactory so that I can control what port is used to establish a connection and what port used to send data. Here are my settings: connection port: 11000 data port: 11100
Now, what I need to know, once again due to firewall issues, is who requests to open the connection port first and who requests to open the data port first.
I understand that the client obviously makes the first connection to the server, and hence it is the client that requests to open the connection port (in my case 11000). But after this, is it the server that requests to open the 11100 for data trannsfer as a response? Or does the client request this port to be opened together with the request to open the connection port?
I hope this question made sense, and I thank any responses in advance.