很长的ajax响应时间?

Based on my understanding ajax respond(return) can not be more than a couple of seconds. So is there any way you can ajax every couple minute or second and check if result is ready(php finished).

The reason I am asking is because my php code is sending data over tcp which it take around 20 min, and I want check the result and show it on the browser.

Right now I am writing the result on file, and then every minute I ajax to another php file which read that file to check it.