websocket

General discussions related to php

Moderators: macek, egami, gesf

Post Reply
NigelRen
php-forum Fan User
php-forum Fan User
Posts: 594
Joined: Fri Aug 05, 2011 9:53 am

Re: websocket

Post by NigelRen » Sat Sep 15, 2012 11:56 pm

A lot of software works by sending requests to various ports ( or sockets ), but usually each package has it's own 'language' if you'd like to call it that. The client software ( which is what your talking about ) needs to know what commands to use and how to interpret the responses.
If you look at MySQL - it uses port 3306 by default, so if you know how to communicate with MySQL, you can talk to that port and execute SQL. Note that when you connect to MySQL from PHP - you use

Code: Select all

<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

// some code
?>
The 'localhost' is the server to connect to and this will connect using the default port - 3306. PHP acts as a client to the MySQL database and sends commands and receives data through this socket.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest