Page 1 of 1

Sockets

Posted: Mon Mar 22, 2004 1:41 pm
by NeoPuma
Hi there,
I'm trying to get a socket to connect to a certain IP, and when connected send some data, and then disconnect. If theres an error connecting or sending data, I want a message like 'Could not connect/send data, try again later...' to appear.

Could any one write an example of some sort please as php.net's is rather confusing >.<

-Neo

Posted: Mon Mar 22, 2004 2:01 pm
by AVATAr
Did you try to do it?

The "Could any one write an example" is not the best question in this forum.

try doing it and then post your code and questions here. I'll be happy to help you.

Posted: Mon Mar 22, 2004 3:33 pm
by NeoPuma
Looking at it,
$address = '192.168.1.53';
$port = 10000;
is all i can really understand. :/
Soz

-Neo

Posted: Tue Mar 23, 2004 7:10 am
by AVATAr
JAJA, well you are a little to away.... well read this first

http://www.php.net/manual/en/function.fsockopen.php
http://www.php.net/manual/en/function.pfsockopen.php

Don't forget to read the users posts!

Posted: Wed Mar 24, 2004 1:47 pm
by NeoPuma
ty m8, ill have a quick read over them now and hope they help me :D

Posted: Wed Mar 24, 2004 2:27 pm
by Zorth
Don't the functions which send data have return values that tell you if there was an error? I know it is this way with C++.