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 response. the server side the allocated port for communication is 3575. So I have to interact wit that port only. As the script that contain the module for the creation of thr socket will execute several time that many sockets are gonnaa create. So my doubt is that can I use the socket that i created in one execution instance to communicate for the other execution instances. Hope its clear...Please help me out...
  • 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 10:05 UTC
    Can I use the socket that i created in one execution instance to communicate for the other execution instances
    IMO it is not possible/not recommended for processes to share same socket handle(single IP and PORT)
    Even though you try that, all instances writing to the same socket will be a mess; unless every request/response has a identification mechanism of itself(like sequence number).
    but your problem can be solved using other ways.
    if you really want to use only one socket, have one dedicated program for socket connection in the client side(which would always be running) which sends and receives data from server, all other your IVR instances can use a Message queue or a shared memory mechanism to connect with this dedicated socket program to send/receive data.
    The above idea brings more complexity to your code, you have to craft it properly. But one common solution is, let all the instances create its own socket, the memory that is going to be used for socket creation is very minimum, the number of socket connections per system also can be tuned(increased/decreased).

    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.
      Yep I understood thanks a lot...
Re^3: How to reuse a Soket and how it will work
by irah (Pilgrim) on Feb 16, 2009 at 10:00 UTC
    It is better you can call the function for creating a socket at once in the initial part. After that you can send and receive a message using that socket descriptor. If you want more please put your code.