PHP client server scripts to faciliate text and binary data transfer.
$30-5000 USD
In Bearbeitung
Veröffentlicht vor mehr als 12 Jahren
$30-5000 USD
Bezahlt bei Lieferung
I need both client and server scripts for a basic application that functions as follows: a client checks in with a server often, the server has a queue (you do not need to manage the queue) of instructions, the server records the client checkin information and, if an instruction exists on the queue, the server sends that instruction to the client. Connections are not persistent, a message ID is shared and the client responds to the instruction at the client's next checkin.
1. Server instructs client to restart services. Client checks in afer restart with update.
2. Server instructs client to send certain file (specified in filename attribute of file node)
3. Server instructs client to run scripts (based on content in description node)
4. Client requests file from server. Server responds with file
5. Client checks in with status
6. Client checks in with file
Again -the instruction queue is managed outsdie of this code and is out of scope for this project. Just use comments in the script to show that it can handle an instruction from the queue
Please post questions if this is unclear. Thanks.
## Deliverables
PHP Client and Server
I need a basic PHP client-server system, including a client script and a server script. The client checks in with the server often as this connection will not be persistent (clients are on DSL modems)
The client should be capable of connecting to the server and sending some or all of the following:
<message from="1234" msgid="22221" >
<status>OK</status>
<description></description>
<file filename="[login to view URL]">[base64encodedContent]</file>
</message>
It should also receive the server's reply and potentially take action based on that, until the reply advises to terminate the session.
The server should listen for connections, accept them, and process them.
1. Parse the message as described above.
2. Extract the file , if one exists, to a working unique temp directory
3. Take steps based on the status and description. I just need a blank switch/case block here.
switch (status) {
case "OK":
switch (description) {
case "receiveFile":
// pickup file from filesystem and move somehwere
break;
case "":
// get file from
break;
...
}
break;
case "ERR":
switch (description) {
case "100":
// handle error 100
break;
case "101":
// handle error 101
break;
...
}
break;
default:
}
4. Log the status, IP, time
An example multi message conversation follows:
(this is a file deployment instruction)
1. Queue receives instruction to deploy a file. The server gets file path, site number, and instuction id
....time passes...
2. Client connects to server, sends ID, IP, status
3. Server records ID, IP, status
4. Server checks queue for insturctions related to the ID. The file deployment insturction is there
5. Server replies with a similarly formatted message
6. Client receives the resopnse XML
... time passess ...
7. Client connects to server, sends IP, ID, status of "OK"
8. Server drops instruction from queue
The most common conversation is
1. Client connects to server with status update
<message from="1234" msgid="22221" >
<status>OK</status>
</message>
2. Server receives that, logs IP, time, from, and msgid. Replies with
<message msgid="22221" >
<status>OK</status>
</message>
Other possible conversations are:
1. Server instructs client to restart services. Client checks in afer restart with update.
2. Server instructs client to send certain file (specified in filename attribute of file node)
3. Server instructs client to run scripts (based on content in description node)
4. Client requests file from server. Server responds with file