Hey everyone, just a quick question. I have a multithreaded TCP server, if I wanted to have the server send a message to a specific client would I be best to have stored the socket when a client connects so I can send data to them then have the client listen on a port like the server does so it can receive and process messages?
Usually the client initiates the connection to the server. The service is listening for connection attempts and responds to them. After a connection has been established both sides can decide to keep it open and use it or to close it. But as soon as the connection is closed the client must initiate a new connection.
Thanks for the replies.
Seems like I wouldn’t be able to have the client listen for incoming messages through TCP outside of receiving a reply.
I don’t fully understand UDP, how would I achieve this using a UDP setup?
Well, you must read about network protocols to see which is proper for your case. Anyway, from what i understand for now you may need server push technology.