I am developing a project in which i am creating a socket using fsockopen()
in a php script to connect to a java server on the same machine only.
Is there anyway to know time it takes for a response to be returned for a request made to the java server ?
sorry for the bad english..an yhelp or guidance appreciated
Asked
Active
Viewed 550 times
0

user2373603
- 11
- 1
- 3
-
1Suppose you could time it with microtime, there is an example of a timing script on the manual http://php.net/manual/en/function.microtime.php – Lawrence Cherone May 11 '13 at 19:47
-
ok will give it a try – user2373603 May 11 '13 at 19:54
-
you can set max_execution_time to make sure it waits for only specific amount of time.. – Dinesh May 11 '13 at 20:02
-
i have a `timeout()` function that checks it ,i want to check the response time!! – user2373603 May 11 '13 at 20:06
1 Answers
0
If you just need to do this as a one-off you could either use xdebug
to profile a request or strace
on the process with timing enabled. A more crude method to time this would be to compare microtime()
values before/after the call.

James C
- 14,047
- 1
- 34
- 43