How to fix the local port in a TCP Client connection instead of a random port?
Posted: Sat May 18, 2019 11:43 am
Hello, friends,
I have a question:
Is it possible to fix a local port during the TCP Client connection on ESP32 (Arduino IDE)?
My device must connect to a TCP server at a certain port, and this step is done without any problems using it:
Unfortunately the local port changes with each connection and I have problems with the network policies set by the IT department that have opened only one port (11001) and I have to be able to use only that!
Attached a screenshot taken from the server side where you can see that the remote port (local for esp32) changes dynamically.
maybe this methods of the class 'WiFiClient' can help me? but I can't find any documentation about it:
ps. using Python on a different device I can fix the local port
thank you all for your help,
Pino
I have a question:
Is it possible to fix a local port during the TCP Client connection on ESP32 (Arduino IDE)?
My device must connect to a TCP server at a certain port, and this step is done without any problems using it:
Code: Select all
WiFiClient client;
if (!client.connect(host, port)) {
....
return;
}
Attached a screenshot taken from the server side where you can see that the remote port (local for esp32) changes dynamically.
maybe this methods of the class 'WiFiClient' can help me? but I can't find any documentation about it:
Code: Select all
int setSocketOption(int option, char* value, size_t len);
int setOption(int option, int *value);
thank you all for your help,
Pino