Oct-19-2018, 06:10 PM
I have an app that fires off a bunch of threads, each starting client code to collect data from a socket server on an ip address.
The app starts the threads.
The threads get answered.
The threads process data.
The threads close.
Start again.
Which is all fine until...
The app starts the threads.
Some threads don't get answered.
Some threads don't process data.
Some threads don't close.
Start again. >> Now I have 2 threads open trying to connect to a bunch of ip address' that aren't going to answer.
At the moment this is pretty much code all on the first indent. I assume the best thing to do is write a class with all the handling code inside, then we set off instances of the class checking against an arbitrary field.
Is this the way to go, or is there a better idea?
Many thanks.
The app starts the threads.
The threads get answered.
The threads process data.
The threads close.
Start again.
Which is all fine until...
The app starts the threads.
Some threads don't get answered.
Some threads don't process data.
Some threads don't close.
Start again. >> Now I have 2 threads open trying to connect to a bunch of ip address' that aren't going to answer.
At the moment this is pretty much code all on the first indent. I assume the best thing to do is write a class with all the handling code inside, then we set off instances of the class checking against an arbitrary field.
Is this the way to go, or is there a better idea?
Many thanks.