1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-06-29 11:40:38 +00:00
QB64-PE/internal/help/PUT_(TCP%2FIP_statement).txt
SteveMcNeill 33adc04fc4 Add temp folder to repo. It's necessary as well!
Just more initial setting on... nothing much to see here.
2022-04-28 13:39:56 -04:00

40 lines
1.7 KiB
Plaintext

The '''PUT #''' TCP/IP statement sends unformatted(raw) data to an open connection using a user's handle.
{{PageSyntax}}
:: '''PUT ''#handle'', , ''data'' '''
{{Parameters}}
* The ''handle'' value is returned by the [[_OPENCLIENT]], [[_OPENHOST]] or [[_OPENCONNECTION]] '''QB64''' functions.
* The ''data'' can be any variable type value. Literal values are not allowed.
<center>'''Communicating using unformatted/raw streamed data:'''</center>
* Benefit: Communicate with any TCP/IP compatible protocol (eg. FTP, HTTP, web-pages, etc)
* Disadvantage: Streamed data has no 'message length' as such, just a continuous bunch of bytes all in a row. Some messages get fragmented and parts of messages can (and often do) arrive at different times.
* The position parameter (between the commas) is not used in TCP/IP statements as all data is streamed consecutively.
<center>'''Your program MUST cater for these situations manually.'''</center>
{{WhiteStart}}''Example: string variable b$'s length is adjusted to the number of bytes read.''
{{Cb|PUT (TCP/IP statement)|PUT #}}client, , a$ 'sends data (this could be a string, variable array, user defined type, etc)
{{Cb|GET (TCP/IP statement)|GET #}}openconn, , b$ 'reads any available data into variable length string b$
{{Cb|GET (TCP/IP statement)|GET #}}openconn, , x% 'reads 2 bytes of data as an integer value.
{{WhiteEnd}}
: ''Explanation:'' Checking [[EOF]](o) is unnecessary. If 2 bytes are available, they are read into x%, if not then nothing is read and [[EOF]](o) will return -1
''See the example in [[_OPENCLIENT]]''
''See also:''
* [[GET (TCP/IP statement)]], [[PUT|PUT #]]
* [[_OPENCLIENT]], [[_OPENHOST]], [[_OPENCONNECTION]]
{{PageNavigation}}
<