vbGore Free Online RPG Engine

Revolutionizing Visual Basic ORPG Development
It is currently Wed Jun 19, 2013 7:52 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: php sockets?
PostPosted: Wed Feb 18, 2009 9:48 pm 
Dim Cheese As String

Joined: Fri May 16, 2008 12:54 pm
Posts: 271
I'm trying to connect to my game server and register an account through webpages instead of through my compiler language.


i keep getting this error:

socket_recv() [function.socket-recv]: unable to read from socket

Code:
        $churl = @fsockopen(server_manip('65.75.250.190'), 9105, $errno, $errstr, 20);
        if ($churl)
        {
            $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
            socket_connect($sock,"65.75.250.190", 9105);
            socket_set_block($sock);
            echo 'here';
            switch(socket_select($r = array($sock), $w = array($sock), $f = array($sock), 20))
            {
                case 2:
                    exit;
                    echo "Registration Failed";
                    break;
                case 1:
                        $msg = 'some message I send';
                        socket_write($sock, $msg, strlen($msg)); //Send data
                        //loop till we receive registration was ok.
                        while (strlen($terminator) <= 5)
                        {
                            $nr=socket_recv($sock,$terminator,250,0);
                        }
                        echo $terminator;
                        if($terminator == "my_other_message" . ' ')
                        {
                            $continue = true;
                        }
                        else
                        {
                            echo 'Failed';
                            socket_close($sock);
                            exit();
                        }
                       
                        socket_close($sock);
                       
                        break;
                case 0:
                        echo 'Failed';
                        socket_close($sock);
                        exit();
                        break;
            }
        }
        else
        {
            echo 'Couldnt Connect to game server';
            exit();
        }


Top
 Profile  
 
 Post subject: Re: php sockets?
PostPosted: Wed Feb 18, 2009 9:54 pm 
Richardf's Evil Minion

Joined: Wed Feb 18, 2009 9:36 pm
Posts: 117
Look at vbgoreSP for examples. Also make sure the dm is on the same server.


Top
 Profile  
 
 Post subject: Re: php sockets?
PostPosted: Wed Feb 18, 2009 10:15 pm 
Dim Cheese As String

Joined: Fri May 16, 2008 12:54 pm
Posts: 271
dm?


Top
 Profile  
 
 Post subject: Re: php sockets?
PostPosted: Wed Feb 18, 2009 11:02 pm 
Dim Cheese As String

Joined: Fri May 16, 2008 12:54 pm
Posts: 271
the links to download vbgoreSP is broken.


Top
 Profile  
 
 Post subject: Re: php sockets?
PostPosted: Thu Feb 19, 2009 5:48 am 
Slave to the BB

Joined: Tue Jul 31, 2007 8:45 am
Posts: 3273
Location: United Kingdom
http://sp.animenetworx.net/

Although, it adds the user to the sql database, not by connecting to the server.


Top
 Profile  
 
 Post subject: Re: php sockets?
PostPosted: Thu Feb 19, 2009 2:35 pm 
=^.^= Kitty =^.^=

Joined: Tue Mar 20, 2007 10:46 pm
Posts: 1821
Location: Sydney Australia
Adding to the MySQL is much more...appropriate then adding to it through the game server it also will open up a vunerability - easy to just keep refreshing the page and screwing up your server in the process.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 8 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group