java - How server replies to more number of clients from the same port number for same and different type of process? -
i having doubt whether server connected different clients processing same process can send data more number of clients use different ports transferring data clients or same port transferring , explain little assigning of ports in terms of different process also
it works threads. think of thread if instance of function of process. whenever client connects single server process, thread instantiated , have job keep connection, exchange data etc user. have thread each user, basically.
however, not possible, callbacks come in handy. callbacks asynchronous functions called after event (such "packet received"), there no threads in case, should careful data integrity (callbacks may return values if didn't receive full data yet) , race conditions.
please correct wrong in answer.
tldr: have 1 port on server, , on port there's service work in of 2 ways. (client's port might change, that's nothing worry if working tcp)
Comments
Post a Comment