Location: PHPKode > projects > TVEz - Media Library > tvez-0.2.1/html/player/socket.php
<?php

# ------------------------------------------------------------------------------
#
# This file contains the socket php code
#
# ------------------------------------------------------------------------------
#
# Copyright (C) 2003 Christian Eheim and Alex Pachikov
#                                                                               
# This file is part of TVEz (tvez.sourceforge.net).
#                                                                               
# TVEz is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#                                                                               
# TVEz is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#                                                                               
# You should have received a copy of the GNU General Public License
# along with TVEz; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#                                                                               
# ------------------------------------------------------------------------------
#
# Created on 02/12/2003 by Christian Eheim
#
# LAST MODIFIED:
# $Date: 2004/01/13 02:56:36 $
# $Revision: 1.2 $
# $Author: eheim $
#
# ------------------------------------------------------------------------------

function send_command($command) {
	require "../../config/config_file.php";
	require_once "../locale/localize.php";

	$fp = @fsockopen ($TVSERVER, $TVPORT, $errno, $errstr, 30);
	if (!$fp) {
		$lines = "<b>$errstr ($errno)</b><br>\n";
		$lines .= localize_string("The TVEz server might not be running").".<br>\n";
	} else {
		fputs ($fp, $command);
		while ($fp && !feof($fp)) {
			$line = fgets ($fp,128);
			$line = chop($line);
			// How do I send a proper EOF???
			if ($line == "ENDTX") break;
			$lines .= $line."\n";
		}
		fclose ($fp);
		$errno = 0;
	} 
	return array($errno,$lines);
}

?>
Return current item: TVEz - Media Library