Sockets

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
NeoPuma
Forum Commoner
Posts: 26
Joined: Sat Mar 06, 2004 12:18 pm
Location: South Wales, UK
Contact:

Sockets

Post 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
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Post 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.
NeoPuma
Forum Commoner
Posts: 26
Joined: Sat Mar 06, 2004 12:18 pm
Location: South Wales, UK
Contact:

Post by NeoPuma »

Looking at it,
$address = '192.168.1.53';
$port = 10000;
is all i can really understand. :/
Soz

-Neo
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Post 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!
NeoPuma
Forum Commoner
Posts: 26
Joined: Sat Mar 06, 2004 12:18 pm
Location: South Wales, UK
Contact:

Post by NeoPuma »

ty m8, ill have a quick read over them now and hope they help me :D
Zorth
Forum Commoner
Posts: 76
Joined: Fri Feb 20, 2004 8:00 pm

Post 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++.
Post Reply