We define the whole program as an APP.
The APP must do the following :
1. Must be optimized for performance ( allow more than 1000 active connections in the same time )
2. Must have a configuration file
3. Must keep in memory, while running some data, and also listen for commands to a specific port.
4. Must save the memory data to a file, and load that file on startup.
5. Must act as a proxy for one HTTP stream like this : client connects to the app to some port , the app will connect to the corresponding stream asked by the client, then forward the packet received by that stream to the client connection. Be careful ! NOT FORWARD THE CLIENT to the stream !!!! PROXY !
Parameters in config file :
1. CMS SERVER ( ip address )
2. SECRET KEY ( text & numbers )
3. PORT TO LISTEN FOR CONNECTIONS
4. PORT TO LISTEN FOR ADMIN COMMANDS
5. LOG FILE PATH
6. PID FILE PATH
7. MAXIMUM CONNECTIONS ( 1 to 1000 )
8. DATA FILE
So the flow will be like this :
APP will listen on 2 ports, for example 80 and 8080, where 80 is client connections , and 8080 is admin connections.
When starting , app will search firstly for /[url removed, login to view] for example, and this URL will return an array ( in any format you want ) containing : Clients -> STB's -> Channels ( mainly their id's )
If the data is received, it must be wrote in the DATA FILE.
If the URL can't be retrieved , then the app will look for the saved DATA FILE.
No matter from where will get the data, the APP will store in memory while running the data, and also will write the DATA FILE at every change.
If no data can be retrieved, from URL or from FILE, then APP will exit with a custom error message.
While running, assuming has the data from one of the sources, app will start listening for connections.
On port 8080 is ADMIN connections, so the app will take some commands there : for example : http://ip:8080/SECRET_KEY?command=add&client=10&stb=11&channels=11,12,13
This will add the client with the stb with the channels to the memory array, and after adding, write the DATA FILE. Changes to the array will be made ONLY when receiving the ADMIN commands. No other way.
I will give a set of available commands and how to manage those commands. For example you can't add a STB without a client id.
On port 80 will listen for client connections.
So, stb number 1, will connect to port 80 and ask for the channel 11. The APP will check if the channel 11 is contained in the array of data, withing the STB number 1. If not, will give a custom error message like Access denied and will close the connection.
If the Channel number is found under the stb, then, the APP will establish a new connection with the link which is in data for the correcponding channel , and proxy the packets received to the client connection, until it will disconnect. Protocol is HTTP.
After data is received, for about 10 seconds, the APP will access a link to notify our system that the client connected to the channel. so it will access http://cms ip/[url removed, login to view];channelid=11&status=connected for example
When client connection is closed, again it will update with the same link , but different status.
All other tweaks and checks depending only of the data received by STB compared with data from memory. For example we can add extra username and password check, so the stb will send an username and a password in the request, and will be compared with the data of the STB array.
FOr other questions, contact me.
5 freelancers are bidding on average $550 for this job
Hi I'm experienced developer with long success history on RentACoder/vWorker/Freelancer. The task is interesting for me. Please check PMB for some details. Regards Alexander