| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <html>
- <head>
- <title>Blitz3D Docs</title>
- <link rel=stylesheet href=../css/commands.css type=text/css>
- </head>
- <body>
- <h1>OpenTCPStream (ip$,port)</h1>
- <h1>Parameters</h1>
- <table>
- <tr>
- <td>
- ip$=Address of stream
<br />
- port=TCP/IP Port Number
- </td>
- </tr>
- </table>
- <h1>Description</h1>
- <table>
- <tr>
- <td>
- Use this command to open up a TCP/IP stream to the designated server and port. If the open command was successful, the command returns a stream handle. Otherwise it returns 0.
<br />
-
<br />
- You can use this for a multitude of different 'internet' options. Obviously to contact a TCP/IP host outside your own network, you'll need to be connected to the Internet.
<br />
-
<br />
- The IP address can be in the form of 1.2.3.4 or "www.domain.com".
- </td>
- </tr>
- </table>
- <h1><a href=../2d_examples/OpenTCPStream.bb>Example</a></h1>
- <table>
- <tr>
- <td>
- ; OpenTCPStream/CloseTCPStream 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 />
- Wend
<br />
-
<br />
- If Eof(tcp)=1 Then Print "Success!" Else Print "Error!"
<br />
-
<br />
- CloseTCPStream tcp
<br />
-
<br />
- WaitKey
<br />
- End
<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=OpenTCPStream&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
- </html>
|