I have a single client that is trying to connect to my main server using socket s1. The client needs to keep trying to connect to main server with s1, but at the same time connect and keep sending "trying" messages to my secondary server. Is it a good idea to create 2 sockets,reuse port and create 2 binds for those 2 sockets or there are better ways to achieve this? This is a client side and using C sockets. Thanks.
If your program is a client to multiple servers, use one socket per server. You don't need bind for a client socket at all, just connect.
I think you are using TCP socket( aren't you?). So one socket for connection is needed. Then reuse port is not so important because your application is a client application, which is the part the start the connection. Any outbound port should be ok.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With