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
php/mysql problem
Hey all,
Problem: im trying to setup a shop where people can use a drop-down list to select t
need help with mail()
hi i want to send an email with attaching pdf file using php. i have the following script but the pr
How to assign JS screen.width to ASP.Net variable
I've got this ASP.net routine that gets the cookie value of the screen width, but now I need to chan
Unidentified index error in a simple form
I have been trying to make an HTML form that is handled by a PHP script. So far my attempts to get i
login to other site by sending post variables
hey,
here is my problem: my school gave me a mail account for school-stuff use. they mail us
Splitting Attributes
SQL> SELECT I_NAME, substr(I_NAME,1,instr(I_NAME,'O')) "First part",
substr(I_NAME, IN
Request-URI Too Large
I have created a simple submit form for a mysql database that puts a piece of code into database.<
PHP Login
Hey!
I got this shopcart code online, am trying to modify it but am getting an error when i try a
RSS poster script?
I have found a script that posts RSS's for me on a site that I'm building. However I would like to a
i need help with php header and footer
I have designed a header and footer for my site and they seem to be ok when they are running individ