Socket Server
Posted on
16th Feb 2014 07:03 pm by
admin
In my following socket server, I am trying to listen to a connection through port 12345 in my web browser. http://127.0.0.1:12345/
I assumed that the following would detect that something was trying to connect to the port through the browser, using socket_create_listen(). I don't know if I am doing something wrong or just not understanding what socket_create_listen() is doing.
Did you know?Explore Trending and Topic pages for more stories like this.
Does anyone know why when going to the address, my socket server isn't detecting the connection?
Note: The client is supposed to be the web browser, not another php file.
Here is my server class:
Code: [Select]<?php
set_time_limit(0);
class Pherver{
private $setup;
public $server;
public $connections;
function __construct(){
$this->setup = parse_ini_file("config.ini", TRUE);
$this->server = socket_create_listen($setup['server']['port'], $etup['server']['connections']);
socket_listen($this->server);
}
function start(){
while($client = socket_accept($this->server)){
socket_write($client, "hello");
print "here";
}
}
}
?>
Here is how I start the server:
Code: [Select]<?php
include 'Pherver.php';
$server = new Pherver();
$server->start();
?>
Thank you
No comments posted yet
Your Answer:
Login to answer
324
31
Other forums
Am I setting up my sites oldschool?
Ok,
When I create a site I open a basic template that I have created that consists of a css f
foreach iterator
Hi Guys
Does the foreach loop have an inbuilt iterator ?
IS Retail & Manufacturing
Hi
Can IS Retail and Manufacturing activities be done in same instance ie. in same client
frames get header location..
i have two frames, one top, one bottom. how do i do a form on the bottom frame that gives me the ur
Referential Integrity problem when inserting into 2 tables at same time
Hello Everyone,
Im relativity new to PHP and MySQL and i have come up against a problem. i h
SESSION question
I am building an application , a directory for auctions.
For SEO i made a script which copies a p
pagination - need help on passing of search query.
Hi, i have been trying for days but couldn't get this sorted out. Would like some professional help
Change Web page language
i doing this thing first time but i dont find any suitable solution for it. On the demand of user. I
PHP form help required
Hi all! Apologies in advance for having to message the forum for help. I know you must get a lot of
Creation of Raw Exposure manually
SAP Gurus
I am creating Raw Exposure ( Hedge management ) thru T Code TEM10 with followin