Hey, im pretty new to php but i have experience with other languages like java. I have a few questions:
how fast are php udp sockets and are they efficent enough to make a real time online game?
what are the restrictions?
can i host a server from a browser? or can two clients communicate without a server but with the knowledge of ips?
thx for now
php UDP sockets
Moderator: General Moderators
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: php UDP sockets
For starters PHP sockets are based on BSD sockets so they are likely as a good as that.
http://ca.php.net/manual/en/intro.sockets.php
Why can't you send information using TCP? What kind of information are you transmitting?
http://ca.php.net/manual/en/intro.sockets.php
Why can't you send information using TCP? What kind of information are you transmitting?
Re: php UDP sockets
Game data is generally sent over UDP. Speed is of the essence and you don't want to waste precious time making sure every packet gets through, do you?
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: php UDP sockets
I realize that but real time web based game and real time desktop game are slightly different paradigms. Web based games, while real time, still only get updated when the user refreshes or AJAX request polls a data source for changes, etc.Game data is generally sent over UDP. Speed is of the essence and you don't want to waste precious time making sure every packet gets through, do you?
So if OP is talking about Chess or Battleship then TCP/HTTP should work fine...if he has somehow figured out how to make the game more instantly interactive using JS and/or Flash then maybe UDP is the way to go...I've only ever played Chess...I keep Flight Simulator on my desktop.
"We're going ballistic Mav"
I love that movie...I've probably watched it like 3-4 times a year for the last 25 years."Talk to me Goose...talk to me"
"Negative Ghostrider the pattern is fold"
Cheers,
Alex