What makes you optimize this part of the code(Socket creation), IMO creating socket for every IVR instance is a good idea and it won't affect the start of your application much.
if you want to make your script efficient/optimize there may be other areas in your script where you have to look in for optimization.
storing the socket handle, database handle etc; for later re-use is not needed in this case.
because if you take IVR other side caller is not going to be a machine; 99% of the times it would be human, to create and initialize a socket it won't take that much of time (it would happen in micro seconds or even less), the caller or you wouldn't even see a delay in execution speed of the script in this socket creation and initialization part.
Vivek
-- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.
| [reply] |
If I understood you correctly, you wanna reuse TCP connection established by one process in another process. That's possible if you establish connection in parent process and use it in child process. But you should maintain pool of connections in parent process in this case.
If your processes are not in a parent-child relationship, you can't share connections between them.
It would be very helpful if you demonstrate what you are trying to do with some code.
| [reply] |