How to fixed receiving port in TCPClient?

Hi.
I want to fix receiving port number in TCPClient.
Is it possible ?

I use…
of_v0.8.4_win_cb_release
codeblocks-12.11.mingw
windows7

and…
addons/ofxNetwork/ofcTCPClient

Thanks.

Are you calling setup with the IP and port number like this:

int port = 4232;
std::string address = "192.168.0.1";
client.setup(address, port);

Thanks,bakercp!

I was sorry for not explaining enough…

I’m making clientApp.
I want to fix the port number about this clientApp (clientPC).

because…
One device of server sends command to fixed IPaddress , fixed port.
I need to receive that command by clientAPP.

(Device of server can not change the spec.)

Do you mean that you want to know the source port from the messages you send as the server uses that to respond to?

Thanks,fresla!

I want to fix source port.
I know it’s an unusual…

I try to that by O.S.

I had a similar problem. After looking around it should be an option but it is not implemented. I made a dodgy implementation for UDP, you can see it here. It worked but I doubt it is the best way to do it.

I know that the networking included in boost can do this,
http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/reference/ip__tcp/socket.html
I am not sure if any of the ofxBoost addon implementations have this functionality though.

You can also use sockets directly either from the POCO library as I tried (this makes it cross platform) or you can just code with sockets in your app.

Fred

Thanks,fresla!

Those are very interesting.
I will try!

However,I decided to make new device of server by programmable controller.
I don’t use existing server,on the network(local network of factory).

I come to think that is best way to the network for future development.

Thanks a lot.