Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Data thru TCP and waiting for Response? Pls Help urgent!

Status
Not open for further replies.

Forri

Programmer
Joined
Oct 29, 2003
Messages
479
Location
MT
Hi All

I need to send a string to a particular server and a particular port! and for this i use:

$fp = fsockopen ("212.56.142.234",2006, $errno, $errstr, 30);

The data is sent:

fputs ($fp, $str);

The next line is:

$Result = fgets ($fp,4096);

This should receive an answer from the above connection! it should be a very simple ascii string.

At first i was using the following:

while (!feof($fp)) {
$Result = fgets ($fp,4096);
}

But this took ages and it did not work most of the times!

Then i removed the loop and left:

$Result = fgets ($fp,4096);

But that didn't work as i received a null value!

Can anyone pls, pls help me in solving this thanks!!

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top