PHP - Apache process use the created socket by another process

85 views Asked by At

This is my first question on this site so I'll try to be as clear as possible.

We're building an EPP client to talk to Nominet EPP service. Nominet limits the sessions to be established by us to 5 sessions at a time. Source: http://registrars.nominet.uk/gtlds/gtld-registrar-systems/epp-gtlds

The problem that we're tackling here is we can't create a new socket every time the new Apache request comes in because of we might have 10 users that use this function at the same time.

What I'm thinking right now is we implement one script that creates 5 sockets and keeps them alive by sending hello command to Nominet occasionally (before the timeout, obviously). Then when the new process created by Apache, that process will use the exists sockets to send the command to Nominet.

The problem is I did a lot of research but can't find any way to do this, so I ended up looking for someone who knows more about this stuff.

Here is what I found but it's not what we want (not include some URL that I forgot to save while I was doing the research): PHP Threads Sharing a Central Socket Object

Anyone know how to implement the sharing socket schema? I would be more than appreciated if someone can help on this.

Also, if you know the solution in another language, please do tell. We're open for the new languages and architecture.

Thanks :)

1

There are 1 answers

0
Patompong Savaengsuk On

Just finally got it works, I use a socket to solve this problem. This is how:

Process A connect to Nominet and keep the connection alive. It also opens the listener at port X.

Process B (apache process) will send the XML to process A via socket port X, then port A will forward that to the opening socket to Nominet and send XML back to process B.