Location: PHPKode > scripts > XS PHP Library > xs-php-library/doc/net/Socket.html
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Frameset//EN''http://www.w3.org/TR/REC-html40/frameset.dtd'>
<!--NewPage-->
<HTML>
<HEAD>
	<!-- Generated by PhpDoc date: 'Mon, 11 Nov 2002 23:47:33 +0100' -->
	<TITLE>Docs For Class Socket</TITLE>
<LINK REL ='stylesheet' TYPE='text/css' HREF='stylesheet.css' TITLE='Style'>
</HEAD>
<BODY BGCOLOR='white'>

<!-- Start of Class Data -->
<H2>
	Class Socket
</H2>
<pre>
<pre><a href="../core/Object.html">Object</a>
   |
   --Socket</pre>
</pre>
<H3>
	Classes extended from Socket:
</H3>

<p>
	<b><i>Located in File: Program_Root/socket.inc.php</i></b><br>
</p>
<hr>
<!-- ========== Info from phpDoc block ========= -->
<b>Generalized Socket class.</b>
<pre>
Socket class enables comfortable handling Socket connections.
</pre>
<UL>
	
	<LI><b>Package</b> - <CODE>net</CODE></LI>
	
	<LI><b>Version</b> - <CODE>$Id: Socket.html,v 1.2 2002/11/28 09:45:12 rbala Exp $</CODE></LI>
	
	<LI><b>Access</b> - <CODE>public</CODE></LI>
	
	<LI><b>Author</b> - <CODE>Robert Bala &lt;<a href="mailto:hide@address.com">hide@address.com</a>&gt;</CODE></LI>
	
</UL>

<hr>
<!-- =========== VAR SUMMARY =========== -->
<A NAME='var_summary'><!-- --></A>
<TABLE BORDER='1' CELLPADDING='3' CELLSPACING='0' WIDTH='100%'>
	<TR BGCOLOR='#CCCCFF' CLASS='TableHeadingColor'>
		<TD>
			<FONT SIZE='+2'><B>Class Variable Summary</B></FONT>
		</TD>
	</TR>

	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#$_blocked'>$_blocked</A></B></CODE>
			<BR>
			<blockquote> Whether the socket is blocking. </blockquote>
			<blockquote> Default Value: <CODE>-><-</CODE> </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#$_buffer'>$_buffer</A></B></CODE>
			<BR>
			<blockquote> Number of bytes to read and write at IO operations. </blockquote>
			<blockquote> Default Value: <CODE>-><-</CODE> </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#$_handle'>$_handle</A></B></CODE>
			<BR>
			<blockquote> Socket handle. </blockquote>
			<blockquote> Default Value: <CODE>-><-</CODE> </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#$_host'>$_host</A></B></CODE>
			<BR>
			<blockquote> IP address or host name. </blockquote>
			<blockquote> Default Value: <CODE>-><-</CODE> </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#$_port'>$_port</A></B></CODE>
			<BR>
			<blockquote> TCP port number. </blockquote>
			<blockquote> Default Value: <CODE>-><-</CODE> </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#$_timeout'>$_timeout</A></B></CODE>
			<BR>
			<blockquote> Number of seconds to wait on socket connections. </blockquote>
			<blockquote> Default Value: <CODE>-><-</CODE> </blockquote>
		</TD>
	</TR>
	
</TABLE>

<hr>
<!-- =========== VAR SUMMARY =========== -->
<A NAME='var_summary'><!-- --></A>
<TABLE BORDER='1' CELLPADDING='3' CELLSPACING='0' WIDTH='100%'>
	<TR BGCOLOR='#CCCCFF' CLASS='TableHeadingColor'>
		<TD>
			<FONT SIZE='+2'><B>Inherited Class Variable Summary</B></FONT>
		</TD>
	</TR>

	
</TABLE>

<hr>
<!-- =========== INHERITED METHOD SUMMARY =========== -->
<A NAME='functions_inherited'><!-- --></A>
<TABLE BORDER='1' CELLPADDING='3' CELLSPACING='0' WIDTH='100%'>
	<TR BGCOLOR='#CCCCFF' CLASS='TableHeadingColor'>
		<TD>
			<FONT SIZE='+2'><B>Inherited Method Summary</B></FONT>
		</TD>
	</TR>

	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<FONT SIZE='+2'><B>Inherited From Class <a href="../core/Object.html">Object</a></B></FONT>
			<blockquote>
			<TABLE BORDER='1' CELLPADDING='3' CELLSPACING='0' WIDTH='95%'>
				<tr>
					<th>Function</th>
					<th>Description</th>
				</tr>
				
				<tr>
					<td><CODE><B><A HREF='../core/Object.html#constructor Object'>constructor Object (  )</A></B></CODE></td>
					<td>Object class constructor.</td>
				
				<tr>
					<td><CODE><B><A HREF='../core/Object.html#classMethods'>classMethods (  )</A></B></CODE></td>
					<td>Retrieves the class methods names of the object.</td>
				
				<tr>
					<td><CODE><B><A HREF='../core/Object.html#className'>className (  )</A></B></CODE></td>
					<td>Retrieves the name of the class of the object.</td>
				
				<tr>
					<td><CODE><B><A HREF='../core/Object.html#classParent'>classParent (  )</A></B></CODE></td>
					<td>Retrieves the parent class name for the object.</td>
				
				<tr>
					<td><CODE><B><A HREF='../core/Object.html#classProperties'>classProperties (  )</A></B></CODE></td>
					<td>Retrieves the class properties names of the object.</td>
				
				<tr>
					<td><CODE><B><A HREF='../core/Object.html#inheritsFrom'>inheritsFrom ( [$class = ] )</A></B></CODE></td>
					<td>Check if the objects inherits from the specified class.</td>
				
			</table>
			</blockquote>
		</TD>
	</TR>
	
</TABLE>

<br>
<!-- should have constructor at some point -->
<!-- =========== Method SUMMARY =========== -->
<A NAME='Method_summary'><!-- --></A>
<TABLE BORDER='1' CELLPADDING='3' CELLSPACING='0' WIDTH='100%'>
	<TR BGCOLOR='#CCCCFF' CLASS='TableHeadingColor'>
		<TD>
			<FONT SIZE='+2'><B>Method Summary</B></FONT>
		</TD>
	</TR>

	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#constructor Socket'>void constructor Socket ( [$host = ''], [$port = ''0''], [$timeout = ''180''], [$buffer = ''1024''] )</A></B></CODE>
			<BR>
			<blockquote> Socket class constructor. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#block'>mixed block (  )</A></B></CODE>
			<BR>
			<blockquote> Sets blocking socket connection. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#close'>mixed close (  )</A></B></CODE>
			<BR>
			<blockquote> Disconnects from the peer, closes the socket. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#getBuffer'>int getBuffer (  )</A></B></CODE>
			<BR>
			<blockquote> Gets the socket buffer size. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#getHandle'>mixed getHandle (  )</A></B></CODE>
			<BR>
			<blockquote> Gets the socket handle. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#getHost'>string getHost (  )</A></B></CODE>
			<BR>
			<blockquote> Gets the socket IP address or host name. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#getPort'>int getPort (  )</A></B></CODE>
			<BR>
			<blockquote> Gets the socket TCP port number. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#getTimeout'>int getTimeout (  )</A></B></CODE>
			<BR>
			<blockquote> Gets the socket timed out waiting for data. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#isBlocked'>boolean isBlocked (  )</A></B></CODE>
			<BR>
			<blockquote> Finds whether the socket connection is blocked. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#isEof'>boolean isEof (  )</A></B></CODE>
			<BR>
			<blockquote> Finds whether the socket is at end-of-stream or closed. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#isOpened'>boolean isOpened (  )</A></B></CODE>
			<BR>
			<blockquote> Finds whether the socket is opened. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#open'>mixed open (  )</A></B></CODE>
			<BR>
			<blockquote> Opens socket connection. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#read'>mixed read (  )</A></B></CODE>
			<BR>
			<blockquote> Read data from a socket connection. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#readBuffer'>mixed readBuffer ( &$buffer, [$length = 0] )</A></B></CODE>
			<BR>
			<blockquote> Read buffer from a socket connection. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#readLine'>mixed readLine (  )</A></B></CODE>
			<BR>
			<blockquote> Read a line of data from a socket connection. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#setBuffer'>mixed setBuffer ( $buffer )</A></B></CODE>
			<BR>
			<blockquote> Sets the socket buffer size. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#setHost'>mixed setHost ( $host )</A></B></CODE>
			<BR>
			<blockquote> Sets the socket IP address or host name. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#setPort'>mixed setPort ( $port )</A></B></CODE>
			<BR>
			<blockquote> Sets the socket TCP port number. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#setTimeout'>mixed setTimeout ( $timeout )</A></B></CODE>
			<BR>
			<blockquote> Sets the socket timed out waiting for data. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#status'>mixed status (  )</A></B></CODE>
			<BR>
			<blockquote> Returns information about an existing socket resource. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#unblock'>mixed unblock (  )</A></B></CODE>
			<BR>
			<blockquote> Sets non-blocking socket connection. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#write'>mixed write ( $string )</A></B></CODE>
			<BR>
			<blockquote> Write data to a socket connection. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#writeBuffer'>mixed writeBuffer ( &$buffer, [$length = 0] )</A></B></CODE>
			<BR>
			<blockquote> Write buffer to a socket connection. </blockquote>
		</TD>
	</TR>
	
	<!-- =========== Summary =========== -->
	<TR BGCOLOR='white' CLASS='TableRowColor'>
		<TD>
			<CODE><B><A HREF='Socket.html#writeLine'>mixed writeLine ( $string )</A></B></CODE>
			<BR>
			<blockquote> Write a line of data to a socket connection. </blockquote>
		</TD>
	</TR>
	
</TABLE>

<hbr>
<!-- ============ VARIABLE DETAIL =========== -->

<A NAME='variable_detail'></A>
<TABLE BORDER='1' CELLPADDING='3' CELLSPACING='0' WIDTH='100%'>
	<TR BGCOLOR='#CCCCFF' CLASS='TableHeadingColor'>
		<TD>
			<FONT SIZE='+2'><B>Variable Detail</B></FONT>
		</TD>
	</TR>
</TABLE>


<A NAME='$_blocked'><!-- --></A><H3>$_blocked</H3>
<b>Data type:</b> boolean<br>
<!-- ========== Info from phpDoc block ========= -->
<b>Whether the socket is blocking.</b>
<pre>

</pre>
<UL>
	
	<LI><b>Access</b> - <CODE>private</CODE></LI>
	
</UL>

<HR>

<A NAME='$_buffer'><!-- --></A><H3>$_buffer</H3>
<b>Data type:</b> int<br>
<!-- ========== Info from phpDoc block ========= -->
<b>Number of bytes to read and write at IO operations.</b>
<pre>

</pre>
<UL>
	
	<LI><b>Access</b> - <CODE>private</CODE></LI>
	
</UL>

<HR>

<A NAME='$_handle'><!-- --></A><H3>$_handle</H3>
<b>Data type:</b> mixed<br>
<!-- ========== Info from phpDoc block ========= -->
<b>Socket handle.</b>
<pre>

</pre>
<UL>
	
	<LI><b>Access</b> - <CODE>private</CODE></LI>
	
</UL>

<HR>

<A NAME='$_host'><!-- --></A><H3>$_host</H3>
<b>Data type:</b> string<br>
<!-- ========== Info from phpDoc block ========= -->
<b>IP address or host name.</b>
<pre>

</pre>
<UL>
	
	<LI><b>Access</b> - <CODE>private</CODE></LI>
	
</UL>

<HR>

<A NAME='$_port'><!-- --></A><H3>$_port</H3>
<b>Data type:</b> int<br>
<!-- ========== Info from phpDoc block ========= -->
<b>TCP port number.</b>
<pre>

</pre>
<UL>
	
	<LI><b>Access</b> - <CODE>private</CODE></LI>
	
</UL>

<HR>

<A NAME='$_timeout'><!-- --></A><H3>$_timeout</H3>
<b>Data type:</b> int<br>
<!-- ========== Info from phpDoc block ========= -->
<b>Number of seconds to wait on socket connections.</b>
<pre>

</pre>
<UL>
	
	<LI><b>Access</b> - <CODE>private</CODE></LI>
	
</UL>

<HR>


<hr>
<!-- ============ FUNCTION DETAIL =========== -->

<A NAME='function_detail'></A>
<TABLE BORDER='1' CELLPADDING='3' CELLSPACING='0' WIDTH='100%'>
	<TR BGCOLOR='#CCCCFF' CLASS='TableHeadingColor'>
		<TD>
			<FONT SIZE='+2'><B>Method Detail</B></FONT>
		</TD>
	</TR>
</TABLE>


<A NAME='constructor Socket'><!-- --></A><H3>constructor Socket</H3>
<P><B>void constructor Socket ( [$host = ''], [$port = ''0''], [$timeout = ''180''], [$buffer = ''1024''] )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Socket class constructor.</b>
<pre>
Creates the new instance of Socket class and sets up basic properties.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	
	<DD><CODE>- <i>string $host</i>: IP address or host name, defaults to "".</CODE></DD>
	
	<DD><CODE>- <i>int $port</i>: TCP port number, defaults to 0.</CODE></DD>
	
	<DD><CODE>- <i>int $timeout</i>: number of seconds to wait on socket connections (optional), defaults to 180.</CODE></DD>
	
	<DD><CODE>- <i>int $buffer</i>: number of bytes to read and write at IO operations (optional),  defaults to 1024.</CODE></DD>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='block'><!-- --></A><H3>block</H3>
<P><B>mixed block (  )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Sets blocking socket connection.</b>
<pre>
A read call to a blocking socket will wait for data to become available
 on the stream. If called when the socket is closed, it returns error
 object, otherwise returns true.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='close'><!-- --></A><H3>close</H3>
<P><B>mixed close (  )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Disconnects from the peer, closes the socket.</b>
<pre>
If called when the socket is closed or it couldn't be closed,
 it returns error object, otherwise it returns true.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='getBuffer'><!-- --></A><H3>getBuffer</H3>
<P><B>int getBuffer (  )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Gets the socket buffer size.</b>
<pre>
Returns number of bytes used at socket IO operations.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='getHandle'><!-- --></A><H3>getHandle</H3>
<P><B>mixed getHandle (  )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Gets the socket handle.</b>
<pre>
Returns resource handle if the socket connection is opened, null otherwise.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='getHost'><!-- --></A><H3>getHost</H3>
<P><B>string getHost (  )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Gets the socket IP address or host name.</b>
<pre>
Returns IP address or host name.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='getPort'><!-- --></A><H3>getPort</H3>
<P><B>int getPort (  )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Gets the socket TCP port number.</b>
<pre>
Returns TCP port number.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='getTimeout'><!-- --></A><H3>getTimeout</H3>
<P><B>int getTimeout (  )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Gets the socket timed out waiting for data.</b>
<pre>
Returns number of seconds socket should wait for data.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='isBlocked'><!-- --></A><H3>isBlocked</H3>
<P><B>boolean isBlocked (  )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Finds whether the socket connection is blocked.</b>
<pre>
Returns true if the socket connection is blocked, false otherwise.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='isEof'><!-- --></A><H3>isEof</H3>
<P><B>boolean isEof (  )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Finds whether the socket is at end-of-stream or closed.</b>
<pre>
Returns true if the socket connection is closed or input stream finished,
 false otherwise.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='isOpened'><!-- --></A><H3>isOpened</H3>
<P><B>boolean isOpened (  )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Finds whether the socket is opened.</b>
<pre>
Returns true if the socket connection is opened, false otherwise.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='open'><!-- --></A><H3>open</H3>
<P><B>mixed open (  )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Opens socket connection.</b>
<pre>
If called when the socket is already opened, it returns error object
 otherwise it returns true.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='read'><!-- --></A><H3>read</H3>
<P><B>mixed read (  )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Read data from a socket connection.</b>
<pre>
Reads up to the socket buffer size from the socket connection. Reading
 stops when the socket buffer size have been read or end-of-stream
 reached, whichever comes first. If called when the socket is closed, it
 returns error object otherwise it returns fread() result.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='readBuffer'><!-- --></A><H3>readBuffer</H3>
<P><B>mixed readBuffer ( &$buffer, [$length = 0] )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Read buffer from a socket connection.</b>
<pre>
Reads up to the specified buffer size from the socket connection. Reading
 stops when the specified buffer size have been read or end-of-stream
 reached, whichever comes first. If called when the socket is closed,
 it returns error object otherwise it returns fread() result.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	
	<DD><CODE>- <i>string $buffer</i>: the data to read.</CODE></DD>
	
	<DD><CODE>- <i>int $length</i>: the buffer length, defaults to 0.</CODE></DD>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='readLine'><!-- --></A><H3>readLine</H3>
<P><B>mixed readLine (  )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Read a line of data from a socket connection.</b>
<pre>
Read until either the end of the socket or a newline, whichever comes
 first. If called when the socket is closed, it returns error object
 otherwise it returns all available data up to a newline, without
 that newline, or until the end of the socket as string.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='setBuffer'><!-- --></A><H3>setBuffer</H3>
<P><B>mixed setBuffer ( $buffer )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Sets the socket buffer size.</b>
<pre>
Returns True on success or a error object if the buffer size is not a
 valid integer value.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='setHost'><!-- --></A><H3>setHost</H3>
<P><B>mixed setHost ( $host )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Sets the socket IP address or host name.</b>
<pre>
Returns True on success or a error object if the socket is already
 opened.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='setPort'><!-- --></A><H3>setPort</H3>
<P><B>mixed setPort ( $port )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Sets the socket TCP port number.</b>
<pre>
Returns True on success or a error object if the socket is already
 opened.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='setTimeout'><!-- --></A><H3>setTimeout</H3>
<P><B>mixed setTimeout ( $timeout )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Sets the socket timed out waiting for data.</b>
<pre>
Returns True on success or a error object if the socket is already
 opened.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='status'><!-- --></A><H3>status</H3>
<P><B>mixed status (  )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Returns information about an existing socket resource.</b>
<pre>
If called when the socket is closed, it returns error object,
 otherwise returns information about an existing socket resource.
 Currently returns four entries in the result array: timed_out (bool) -
 The socket timed out waiting for data, blocked (bool) - The socket was
 blocked, eof (bool) - Indicates EOF event unread_bytes (int) - Number
 of bytes left in the socket buffer.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='unblock'><!-- --></A><H3>unblock</H3>
<P><B>mixed unblock (  )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Sets non-blocking socket connection.</b>
<pre>
A read call to a non-blocking socket will return immediately if there is
 no data available on the stream. If called when the socket is closed, it
 returns error object, otherwise returns true.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='write'><!-- --></A><H3>write</H3>
<P><B>mixed write ( $string )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Write data to a socket connection.</b>
<pre>
Write data to a socket connection. Writing will stop after socket buffer
 length bytes have been written or the end of string is reached, whichever
 comes first. If called when the socket is closed, it returns error object
 otherwise it returns fwrite() result.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	
	<DD><CODE>- <i>string $string</i>: the data to write.</CODE></DD>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='writeBuffer'><!-- --></A><H3>writeBuffer</H3>
<P><B>mixed writeBuffer ( &$buffer, [$length = 0] )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Write buffer to a socket connection.</b>
<pre>
Write data to a socket connection. Writing will stop after specified
 buffer length bytes have been written or the end of string is reached,
 whichever comes first. If called when the socket is closed, it returns
 error object otherwise it returns fwrite() result.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	
	<DD><CODE>- <i>string $buffer</i>: the data to write.</CODE></DD>
	
	<DD><CODE>- <i>int $length</i>: the buffer length, defaults to 0.</CODE></DD>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>

<A NAME='writeLine'><!-- --></A><H3>writeLine</H3>
<P><B>mixed writeLine ( $string )</B></P>
<P></P>
<!-- ========== Info from phpDoc block ========= -->
<b>Write a line of data to a socket connection.</b>
<pre>
Write a line of data to the socket, followed by a trailing &quot;\r\n&quot;.
 If called when the socket is closed, it returns error object
 otherwise it returns fputs result.
</pre>
<DL>
	<DT>Function Parameters:</DT>
	
	<DD><CODE>- <i>string $string</i>: the data to write.</CODE></DD>
	

	<DT>Function Info:</DT>
	
	<DD><b>Access</b> - <CODE>public</CODE></DD>
	
</DL>

<HR>


<hr>
</HTML>
Return current item: XS PHP Library