63 lines
1.5 KiB
HTML
63 lines
1.5 KiB
HTML
<html>
|
|
<head>
|
|
<title>Blitz3D Docs</title>
|
|
<link rel=stylesheet href=../css/commands.css type=text/css>
|
|
</head>
|
|
<body>
|
|
<h1>ReadAvail (filehandle/streamhandle)</h1>
|
|
<h1>Parameters</h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
filehandle/streamhandle = handle assigned to the file or stream when originally opened.
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h1>Description</h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
In the case of file streams, this reflects how much data is internally buffered. In the case of TCP streams, this reflects how much data has 'arrived'.
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h1><a href=../2d_examples/ReadAvail.bb>Example</a></h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
; OpenTCPStream/CloseTCPStream/ReadAvail Example
|
|
<br />
|
|
|
|
<br />
|
|
Print "Connecting..."
|
|
<br />
|
|
tcp=OpenTCPStream( "www.blitzbasement.com",80 )
|
|
<br />
|
|
|
|
<br />
|
|
If Not tcp Print "Failed.":WaitKey:End
|
|
<br />
|
|
|
|
<br />
|
|
Print "Connected! Sending request..."
|
|
<br />
|
|
|
|
<br />
|
|
WriteLine tcp,"GET http://www.blitzbasement.com HTTP/1.0"
|
|
<br />
|
|
WriteLine tcp,Chr$(10)
|
|
<br />
|
|
|
|
<br />
|
|
If Eof(tcp) Print "Failed.":WaitKey:End
|
|
<br />
|
|
|
|
<br />
|
|
Print "Request sent! Waiting for reply..."
|
|
<br />
|
|
|
|
<br />
|
|
While Not Eof(tcp)
|
|
<br />
|
|
Print ReadLine$( tcp )
|
|
<br />
|
|
Print "Bytes available:" + ReadAvail(tcp)
|
|
<br />
|
|
Wend
|
|
<br />
|
|
|
|
<br />
|
|
If Eof(tcp)=1 Then Print "Success!" Else Print "Error!"
|
|
<br />
|
|
|
|
<br />
|
|
CloseTCPStream tcp
|
|
<br />
|
|
|
|
<br />
|
|
WaitKey
|
|
<br />
|
|
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<a target=_top href=../index.htm>Index</a><br>
|
|
<br>
|
|
Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=ReadAvail&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
|
|
</html>
|