in reply to Re: How to reuse a Soket and how it will work
in thread How to reuse a Soket and how it will work

Hi, thanks for the replay.... am working for IVR(Interactive voice Respone system) where in which i need to handle hundreds of calls in a second which will land into my server. Wen each call land in the server script is gonna execute which creates a socket. My script has a module which intern interact with one more server and will get a response through the socket created. This instance am explaining for a single call, but wen several call will land at a strech my script will execute that many times,that means script will create that many sockets for the comminication. Now my doubt is, instead of closing the socket each time after getting response how can I use the same socket for all the execute instances, if it is posiible please help me out in doing the same....
  • Comment on Re^2: How to reuse a Soket and how it will work

Replies are listed 'Best First'.
Re^3: How to reuse a Soket and how it will work
by targetsmart (Curate) on Feb 16, 2009 at 09:50 UTC
    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.
Re^3: How to reuse a Soket and how it will work
by zwon (Abbot) on Feb 16, 2009 at 10:40 UTC

    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.