php UDP sockets

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
beloxx
Forum Newbie
Posts: 1
Joined: Sun Nov 16, 2008 11:53 am

php UDP sockets

Post 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
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: php UDP sockets

Post 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?
User avatar
Syntac
Forum Contributor
Posts: 327
Joined: Sun Sep 14, 2008 7:59 pm

Re: php UDP sockets

Post 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?
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: php UDP sockets

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