php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17937 Socket Failure
Submitted: 2002-06-24 00:22 UTC Modified: 2002-07-01 15:31 UTC
From: vardhamansdesai at yahoo dot com Assigned:
Status: Not a bug Package: Sockets related
PHP Version: 4.2.1 OS: Linux 7.1
Private report: No CVE-ID: None
 [2002-06-24 00:22 UTC] vardhamansdesai at yahoo dot com
Hello,

    I am developing a Chat Application Program in PHP ( Server ) and VB ( Client ) using Socket Programming using Red Hat Linux Server 7.1.

    I need to send a message from PHP to VB Client through Socket Program. Here i have a piece of code where in which i am connecting to the server to port 9024 and trying to send a simple message "hello"  to the Client VB. This code works fine of sending this message through socket from PHP to VB in localhost working on Win NT platform.The Client VB recieves the message and displays as alert message, but when VB try to send some message to php , the php code could not able to recieve the message .

Here is the Sample program through which i sent a message in NT Platform

<?
$fp=fsockopen("localhost",9024);
if($fp)
{
    $message="hello";
    fputs($fp,$message);
    echo "Connected";
}
else
{
echo "Not Connected";
}
?>

This was run from the local machine, this did send the message to the Client VB and prompted the message in the VB Software.

The above i tested for the sending data from PHP to VB.

Now the same program i modified and placed one more statement to read the data from the VB Client, the code is

<META HTTP-EQUIV="refresh" content="5;<?PHP_SELF?>">

<?
$fp=fsockopen("localhost",9024);
if($fp)
{
    $message="hello";
    fputs($fp,$message);

   $fromser= fgets($fp,2000);
     
    echo "$fromser";

}
else
{
echo "Not Connected";
}
?>

Her i put the meta tag to keep the page refresh to get the data from VB Application at any time. Here the data sent to VB application where as it did'nt recieve the data from VB.

Can you please tell me whether the above program is correct or not or is there any method to make the connectivity and the recieve message from VB to PHP.

The program sends the message from PHP to VB when run on NT Platform but the same if  i run it on Linux Server it wont prompt anything, Why is this in Linux Server ?
Is there any settings to be done in the php.ini file or in Linux Server Settings.

Note : the Program run on the Linux server has resulted in more error & that is
          I can connect only through port 80 and not with any other non-standard ports,           Can we have any non-standard port fixed for socket connection ? and if yes then           could i know the Procedure please.

I need the following informations from you

1. Whether a non-standard port can be assigned for socket connection in Linux server,      if yes then how it is possible ?

2. Why the above mentioned Program is not Working in Linux Server where as it works     in local server on NT Platform ( i have checked with the php.ini file and it has different     features from what is there in the Linux server, since by my knowledge i think the         php.ini file sets the configuration when it is installed as per the platfrom).Can i get     the perfect information of Configuration in php.ini file which supports the Socket     programming.

 3. can i contact you online and my id is vardhamansdesai@yahoo.com and i will be      online at any time you specify on yahoo msn.

    I will be greatful for any help regarding the above.

   Thank you

 Vardhaman S.Desai

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-01 15:31 UTC] jason@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.

This is not a bug report
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 01:01:28 2024 UTC