Results 1 to 6 of 6

Thread: PHP server side programming

  1. #1
    Join Date
    Nov 2009
    Posts
    42

    PHP server side programming

    I state that I am approaching now the only server side programming (PHP) flavored with a bit of ajax, and I have a question that google can not answer (probably I'm using the wrong words):

    I know the http 1.1 allows to maintain an open channel with the server, then the server can send "alerts" to the client without at that precise time is requested anything (as opposed to version 1.0 in which the connection was falling at the end of sending data, then only the client could make requests.)

    But in practice what are the guidelines to implement something like that? Gmail works well, is it?

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: PHP server side programming

    To create a script that continues to send data to the client that has enough time limit imposed with set_time_limit () and then you do not go out all the time, such as "stuck" in a while loop.

    The only thing you must remember is that the buffer starts to be synchronized after the first 1024 bytes, so to have an output-so-mean real-time need to send anything to the client first 1024 bytes of output itself.

    Delivery of data to print with functions such as customer support and echo each time the flush ().

    I hope you make it clear, otherwise you do the tests and then think.

  3. #3
    Join Date
    Nov 2009
    Posts
    42

    Re: PHP server side programming

    Thanks for detailed answer

    Its clear to me. I am glad that you ask a few more details before you try some evidence, in particular:

    - How to send 1024 bytes of null data to the client?
    - On the client, how to trap the output with JS?

    thanks, to clarify these aspects to do some tests

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    Re: PHP server side programming

    Quote Originally Posted by MAHESA View Post
    Its clear to me. I am glad that you ask a few more details before you try some evidence, in particular:

    - How to send 1024 bytes of null data to the client?
    - On the client, how to trap the output with JS?

    thanks, to clarify these aspects to do some tests
    The first point is simple, you can just send a string of 1024 "spaces" using something like echo str_repeat ( "", 1024)

    The second point I can not help you, but I suppose procedures require the use of AJAX. Ask again, maybe somebody who knows a JavaScript solution might also simplify you.

  5. #5
    Join Date
    Nov 2009
    Posts
    42

    Re: PHP server side programming

    Just for my curiosity sake, if I understood right from the doc I need flush () because otherwise the server waits for the end of the script (which never ends) to send the various echo (), right?

  6. #6
    Join Date
    May 2008
    Posts
    2,297

    Re: PHP server side programming

    Exactly, and how you responded.

    For the first 1024 bytes is not enough to flush, mean you have to send at least that number of bytes because the browser will display (unless the script does not finish first, but it is not your case), but then you can request a flush ie an item to the browser, every time you want to for every single byte.

Similar Threads

  1. Server side Software for Network Audit
    By Valdis in forum Networking & Security
    Replies: 4
    Last Post: 09-12-2010, 10:05 AM
  2. How to Configure Office to run server-side?
    By Orton in forum Windows Software
    Replies: 5
    Last Post: 25-03-2010, 05:39 AM
  3. Problem in server side code
    By New ID in forum Software Development
    Replies: 5
    Last Post: 25-01-2010, 12:53 PM
  4. Replies: 5
    Last Post: 28-11-2009, 05:18 PM
  5. Difference between Server-side and Client-side code?
    By Booth in forum Software Development
    Replies: 2
    Last Post: 08-01-2009, 03:21 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,116,045.43160 seconds with 16 queries