|
Posted by O.J. Tibi on 05/08/06 12:43
Hi all,
I suspect I'm having problems with socket functions within my PHP
application running on Red Hat 2.4.21-4.EL #1/PHP 4.3.2/Apache 2.0.46.
Below is a sample code listing:
================================================================
function sendRequest($strRequest) {
$parser = NULL;
$logman = new LogManager();
$resource = socket_create( AF_INET, SOCK_STREAM, SOL_TCP );
$logman->append("Connecting to OLS Server...");
$socket_conn = socket_connect( $resource, $serverIP, $serverPort );
if( $socket_conn ) {
$logman->append("Connected to {$serverIP}:{$serverPort}.
Sending XML request...");
socket_write( $resource, $strRequest );
$logman->append("XML request sent. Waiting for XML
response...");
$document = "";
$data = socket_read( $resource, 1024 );
while ($data != "") {
$document .= $data;
$data = socket_read( $resource, 1024 );
}
$logman->append("XML response received.");
$parser = new OlsResponseParser;
// parse the received document using our parser
$parser->parse($document);
}
if ($parser != NULL) {
return $parser->getOlsResponse();
}
return $parser;
}
================================================================
The following listing is from the logs I have created...
================================================================
|+-------+---------------------+------------------------------------------------------------+
| LogId | LogDate | LogMessage |
+-------+---------------------+------------------------------------------------------------+
| 37 | 2006-05-03 15:39:28 | /new_userpage_process.php initialized.
Creating buffer... |
| 38 | 2006-05-03 15:39:28 | Connecting to OLS Server...
|
| 39 | 2006-05-03 15:39:28 | Connected to (server):(port). Sending
XML request... |
| 40 | 2006-05-03 15:39:28 | XML request sent. Waiting for XML
response... |
| 41 | 2006-05-03 15:40:34 | XML response received.
|
| 42 | 2006-05-03 15:40:34 | Buffering complete. Redirecting to
thanks.php?actiontype=2 |
+-------+---------------------+------------------------------------------------------------+
================================================================
As you can see, there is a lapse of more than one minutes between
LogId's 40 and 41, which is very slow on a production environment. The
script above acts as a client to another application server listening
on a remote port, running on Java. What the remote application reports
is that it receives the connection request, receives the request data,
and transmits the response data at the same second, while my
application receives the response one minute after the request was
sent!
Other implementations in the enterprise using different architectures
and technologies/languages do not experience the same issue as my app
does.
Please help. Comments, suggestions and thoughts through the group or
private mail are deeply appreciated.
Thanks!
Navigation:
[Reply to this message]
|