:::::'''Communicating using QB64 Formatted messages:'''
* Benefit: QB64 handles sending and receiving data in messages. It knows how long each message is and waits for the full message to arrive, avoiding partial messages which have been fragmented from being returned.
* Disadvantage: Really only useful for communicating with other QB64 programs (or programs aware of QB64's [[TCP/IP Message Format]]).
::::'''See''' [[TCP/IP Message Format]] '''for the QB64 header information'''
:'''NOTE:''' In the following examples 'h' denotes the host's handle, 'c' the client's handle and 'o' as other handles.
''Example 1:'' Host sends one variable value at a time while reading other messages.
{{CodeStart}}
'''PRINT #'''c, a$ ' sends the string a$ (size is known to INPUT #)
'''PRINT #'''c, x% ' if x was equal to 5, this would send ' 5 ' (without the quotes)
''Explanation:'' INPUT #o, x% effectively reads the next message, performs the VAL function upon it and stores the result in x% (if any part of this process isn't complete then [[EOF]](o) will return -1.
''Example 2:'' Host sends multiple values using PRINT #.
''Explanation:'' The loop runs 3 seconds or until the full data arrives. The value of a$ is " 3 Hello World!" or "" if all 4 messages haven't arrived yet.