Skip to content
Advertisement

socket connection code of php

I am writing a simple php socket code.
Here is my code

JavaScript

when I run this program my browser only shows waiting for localhost.
Is there any problem in my code?
I am using xammp 1.7.4 .
Another thing I want to know if I want to get a HTTP or FTP request do I have change only the port number?

Advertisement

Answer

I verified the code and tested in my system and it works correctly. Showing as “client is here” after running the client.

File Name: server.php

JavaScript

First run the server.php file.

File: client.php

JavaScript

Now run the client.php

Your output should be like this (as I got in my system)

I am hereclient is here

If not, make sure your firewall is not blocking the request. Temporarily disable antivirus if you have one.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement