I have a general socket question.
Here is what I am trying to accomplish.
I have a vb program that takes user input and stores it in a database. It then loops with a counter of 30 seconds or until it gets a response in the database with a status of 'C'.
The record in the database gets a status of 'C' from a php script that runs in the background of a Linux machine.
It's job is to look for data in the database send the data to a IP:PORT at another location. Then it updates the response from the IP:PORT back into the database.
I have 130 sites all sending data to the database.
I was wondering if it is possible to have 2 background cues.
1st queue would only look for data in the database and send requests to the IP:PORT
2nd queue would only receive data from the IP:PORT and enter the results back into the database.
I am currently doing it with one queue. And I use fsockopen, fputs, and fgets. I tried to break this up into 2 queues with one using fputs and the other using fgets, but I think you have to put and get on the same script.
I am allowed up to 8 connections on the IP:PORT. So I was hopping I would be able to send and receive with different scripts
Any suggestions
Thanks,
jmsloan
Programming with sockets
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
then no, I'm pretty sure you can't shunt it to a second script for receipt. You could do a cron that starts up 8 instances of the script and use a database as the queue source (setting in the table which instance is working or completed).
What I see is a script that on startup, checks to see how many instances are currently active via looking at the active queue in the database (should also store a start time so you can track hangs and such easier). If an instance is off, you can continue on to turn that script into the next instance. I'd only use 7 instances, leaving 1 as a safety net.
What I see is a script that on startup, checks to see how many instances are currently active via looking at the active queue in the database (should also store a start time so you can track hangs and such easier). If an instance is off, you can continue on to turn that script into the next instance. I'd only use 7 instances, leaving 1 as a safety net.