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 8621471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:49:40+00:00 2026-06-12T06:49:40+00:00

I was wondering if PHP can act as a server over a TCP port?

  • 0

I was wondering if PHP can act as a server over a TCP port? How many IDLE connections can a 1GB RAM server handle? Can PHP receive many connections to one TCP port (like apache does on port 80?)

If i have a client connected to the socket opened by PHP, how can I send data to it? (for example a.php is listening on port 5000, some client is connected, later on b.php needs to send something to that client, well push a message?)

Or shall i use UDP instead?

  • 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-12T06:49:41+00:00Added an answer on June 12, 2026 at 6:49 am

    Friend, my first advice is that even if PHP can do this natively. PHP is not the best technology to implement a TCP Sockets Server. The reason is because remember php
    has max_execution_time for each script and make a server run forever will require set this value to 0 wich means forever. The amount of connections of 1gb of ram server can handle depends on how much ram and processor consume each php process.

    But anyway, if you decide to do it using php. Yes, you can build with php an asynchronous tcp socket server.

    Just create a master socket listening 5000(for example). And for each client sockets that connects with this master socket then create a child socket with a random free port(selected by the os) for each incoming connection and you can start talking with the child socket while releasing the master to continue listening for another incoming connections.

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

Sidebar

Related Questions

We have a client that can't receive emails from a dedicated server using PHP
I was wondering if PHP can do this as there seems to be no
I am wondering if there a function in php that can allow me put
I was wondering how can I validate a single checkbox using PHP and MySQL.
I'm just wondering how I can read a text file in php, I'd like
I was wondering how php files are actually secured. How come one can not
Wondering how I can change the php session id from PHPSESSID to something else
I am wondering if I can change PHP's overall date , to think its
I was just wondering how you can echo a range of dates in PHP
I was wondering if i can to make url such like this: http://www.google.com/index.php?id=mycustomsearch,javascript:onload=initfunction1(); To

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.