ReadAvail.htm 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>ReadAvail (filehandle/streamhandle)</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. filehandle/streamhandle = handle assigned to the file or stream when originally opened.
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. 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'.
  21. </td>
  22. </tr>
  23. </table>
  24. <h1><a href=../2d_examples/ReadAvail.bb>Example</a></h1>
  25. <table>
  26. <tr>
  27. <td>
  28. ; OpenTCPStream/CloseTCPStream/ReadAvail Example <br />
  29. <br />
  30. Print "Connecting..." <br />
  31. tcp=OpenTCPStream( "www.blitzbasement.com",80 ) <br />
  32. <br />
  33. If Not tcp Print "Failed.":WaitKey:End <br />
  34. <br />
  35. Print "Connected! Sending request..." <br />
  36. <br />
  37. WriteLine tcp,"GET http://www.blitzbasement.com HTTP/1.0" <br />
  38. WriteLine tcp,Chr$(10) <br />
  39. <br />
  40. If Eof(tcp) Print "Failed.":WaitKey:End <br />
  41. <br />
  42. Print "Request sent! Waiting for reply..." <br />
  43. <br />
  44. While Not Eof(tcp) <br />
  45. Print ReadLine$( tcp ) <br />
  46. Print "Bytes available:" + ReadAvail(tcp) <br />
  47. Wend <br />
  48. <br />
  49. If Eof(tcp)=1 Then Print "Success!" Else Print "Error!" <br />
  50. <br />
  51. CloseTCPStream tcp <br />
  52. <br />
  53. WaitKey <br />
  54. </td>
  55. </tr>
  56. </table>
  57. <br>
  58. <a target=_top href=../index.htm>Index</a><br>
  59. <br>
  60. 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>
  61. </html>