Page 1 of 1

php UDP sockets

Posted: Sun Nov 16, 2008 11:56 am
by beloxx
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

Re: php UDP sockets

Posted: Sun Nov 16, 2008 8:18 pm
by alex.barylski
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?

Re: php UDP sockets

Posted: Sun Nov 16, 2008 8:53 pm
by Syntac
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?

Re: php UDP sockets

Posted: Sun Nov 16, 2008 11:05 pm
by alex.barylski
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?
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.

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. 8)
"We're going ballistic Mav"
"Talk to me Goose...talk to me"
I love that movie...I've probably watched it like 3-4 times a year for the last 25 years.
"Negative Ghostrider the pattern is fold"
:)

Cheers,
Alex