For whatever reason, IT department asked for it if possible. I used the following code but it doesn't seem to work.


Qt Code:
  1. .h
  2. QTcpSocket *m_pSocketClient;
  3.  
  4. .cpp
  5. m_pSocketClient = new QTcpSocket(this);
  6. m_pSocketClient->bind(Specified Address, Specified Port);
  7. m_pSocketClient->connectToHost(Server Address, Server Port);
To copy to clipboard, switch view to plain text mode 


It still uses a random port. What am I doing wrong?