Creating a two-way dynamic rule to allow UDP traffic

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
kerberos
Forum Newbie
Posts: 1
Joined: Tue Aug 16, 2005 4:19 pm

Creating a two-way dynamic rule to allow UDP traffic

Post by kerberos »

Hi,

I have an application that streams audio/video over UDP to xxx.xxx.xxx.xxx:xxxx. Since UDP is connectionless, if the client is behind a router/firewall, there is no way he will be able to watch the stream without configuring the router itself. In theory, a way to enable it would be for the client to initiate and send UDP packets to the server on xxxx port. To keep the connection alive, send packets every 5 seconds or so.

I know this can be done using a Java applet, but for the sake of consistency I would love to do in PHP. I am convinced this is possible but would like to have advices from people who might have done it already, or have ideas as to where to start.

Thanks in advance,
Jerome
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

fsockopen() after using stream_get_transports() <- (requires PHP 5) to determine if your install of php supports udp first.

[edit]
if you look toward the bottom of the manual page on fsockopen, they have a UDP example even.
Post Reply