CloseTCPStream.htm 1.4 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>CloseTCPStream streamhandle</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. streamhandle = handle assigned when the stream was opened.
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. Once you've completed the use of your TCP/IP stream, close the connection you opened with OpenTCPStream with this command.
  21. </td>
  22. </tr>
  23. </table>
  24. <h1><a href=../2d_examples/CloseTCPStream.bb>Example</a></h1>
  25. <table>
  26. <tr>
  27. <td>
  28. ; OpenTCPStream/CloseTCPStream 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. Wend <br />
  47. <br />
  48. If Eof(tcp)=1 Then Print "Success!" Else Print "Error!" <br />
  49. <br />
  50. CloseTCPStream tcp <br />
  51. <br />
  52. WaitKey <br />
  53. End <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=CloseTCPStream&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  61. </html>