Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8611257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:19:50+00:00 2026-06-12T04:19:50+00:00

I have me a socket created in PHP that I am connecting to in

  • 0

I have me a socket created in PHP that I am connecting to in flash/as3. Its working 99%, but…

$bytes = socket_recv($socket, $buffer, 2048, 0);
if ($bytes == 0) {
    //User disconnects
    $index = array_search($socket, $read_sockets);
    $tehEC = socket_last_error();
    $CID = $read_sockets[$index];
    $DNAME = $DB->db->query("SELECT * FROM chat_online WHERE connectid='$CID'");
    $BROW = $DB->db->fetch_array($DNAME);
    $BNAME = $BROW['user_name'];
    $DB->db->query("DELETE FROM chat_online WHERE connectid='$CID'");
    echo "dc " . $tehEC . "\n";
    send_Message($allclients, $socket, $BNAME . ": /disconnected " . $BNAME); <-- WILL NOT SEND
    unset($read_sockets[$index]);
    send_Message($allclients, $socket, $BNAME . ": /disconnected " . $BNAME); <-- WILL NOT SEND 
    socket_close($socket);
}

So I have been able to get an event to fire when a user disconnects and all, but that line not sending makes my life really hard 🙁 any help please? I need it to send that to the other clients so I can remove the users. So again, how can I get the socket server to send a message to all still online clients so they know to remove the disconnected user from the list.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:19:52+00:00Added an answer on June 12, 2026 at 4:19 am

    Actually the problem was I needed to add chr(0) to the end of the string to get it to send. Thank you for the responses though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a basic flash socket server in PHP, it all works fine
Assume that i have created a client TCP Socket in Activity A. I want
I have a BSD socket created with following code (it's in external library that
Hi i have a client connecting to a socket server in php. I want
I have created my web socket server and client using this simple tutorial here
I have created a sample java socket application. I used Socket s = new
I have already created my application on web socket with ASP.net 4.0. I just
I have two applications Web Socket and Web Service created in .Net/Web Form and
I have to create an sample code that connect to a socket server, and
I have a DataInputStream , created from a Socket in Java. The connection is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.