The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 6 of 6

Thread: PHP Socket Server

  1. #1

    PHP Socket Server

    Hello everyone!
    So I've been building a prototype flash/php chat application. I used the php resources located here... <-- great tutorial, thanks!

    I've since built alot of functions onto the server side script but have a single remaining perplexing dilemma.

    The while loop is only running whenever outside data gets sent to a socket.... here is an example of what I am trying to do...

    In the portion of the code which in the original tutorial said...

    PHP Code:
    if (($client socket_accept($master)) < 0) {
    "socket_accept() failed: reason: " .socket_strerror($msgsock). "\n"

    else {

    I've added something like....

    PHP Code:
    if (($client socket_accept($master)) < 0) {
    "socket_accept() failed: reason: " .socket_strerror($msgsock). "\n"

    else {
    $msg"Look what the n00b brought in... errr... welcome to the server\r\n"$client_arr[0]=$client;  

    Now the problem is... it doesn't send the message right away. It waits until the server has gotten a message from someone and then sends it at that time... (it doesn't matter who sent the message). Instead of sending the message right away like a good little script!

    I've found that (like I said previously) the while loop only runs when data gets sent over a socket. Any ideas? I've tried all sorts of things... including tricking it into running... it's a stubborn script and sees right through me. doh!

    Your help is much appreciated... I can send the complete script to you if you'd like to look at it closer. Help!
    Last edited by dietrich; January 27th, 2008 at 11:12 PM. Reason: (Added PHP code)

  2. #2
    use the [ php ] [ /php ] tags ( no spaces though)
    PHP Code:
     See testing 
    Lies are like children. Their hard work but their worth it because the future depends on them-House.

  3. #3
    oh whoops... sorry! (nice signature btw)

  4. #4
    Lies are like children. Their hard work but their worth it because the future depends on them-House.

  5. #5
    Ok so, I feel like teh nub! I forgot to include .chr(0) at the end of the message sent to the client. Flash ignores incoming messages that don't end in null.

  6. #6
    Ok, question #2

    Does anyone know what the message generally refers to...

    PHP Code:
    Warningsocket_write() unable to write to socket [32]: Broke pipe in <insert file info here on line 123

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012