in reply to Single non-server script maintaining multiple client connections
There are many ways to do this. Which is most appropriate really depends upon the nature of the logic involved.
For example, if the conversations with each of the servers is complex and mostly independant of the other, with only the occasional need to share state, then putting each in it's own thread and sharing state through a queue or shared variables may be the simplest approach.
If however, the conversations are highly interdependant with each driving the other, then the select approach makes more sense.
Each approach has both advantages and caveats. The right choice depends entirely upon the nature of the application.
|
|---|