4

I have an app which connects to my web server and transfers data via XML. The headers I connect with are:

POST /app/API/Data/Receiver.php HTTP/1.1
User-Agent: Custom User Agent 1.0.0
Accept: text/xml
Content-Type: text/xml
Content-Length: 1580
Host: servername.com

The app then handles the data and returns its own XML formatted reply. One of the header's I'm setting in the response is:

header("Connection: close");

When I send connect and send my data from a simple app on my PC (C++) it works fine, I get the close header correctly and the connection is closed as soon as the data is available. When I send the exact same data using a GSM modem and and embedded app, the connection header comes back as:

header("Connection: keep-alive");

The GSM modem also sits and waits until the connection is closed before moving on and often just times out.

Is there someway to close the connection on the server so that the GSM side does not time out?

2 Answers 2

2

It is possible that your GSM service provider transparently proxing connections. Try to send data on non-standard port (i.e not 80, 8080, 443)

Also setting cache control header private might work.

Cache-Control: PRIVATE
Sign up to request clarification or add additional context in comments.

Comments

0

Headers are just plain text but cannot be sent once data has been sent in PHP. Try this:

echo "\r\n\r\nConnection: close";
die();

and adjust to your needs

4 Comments

He already sends a Connection: close I believe (from reading his question) it is actually the hardware that is returning Connection: Keep-alive
Well dying should fix that no?
No, because die() only affects the PHP interpreter, not the web server process.
But shutting down the interpreter will close the connection, no?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.