CONNECTED: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
m (Removed protection from "CONNECTED")
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:_CONNECTED}}
{{DISPLAYTITLE:_CONNECTED}}
The [[_CONNECTED]] function returns the status of a TCP/IP connection handle.
The [[_CONNECTED]] function returns the status of a TCP/IP or HTTP connection handle.




Line 8: Line 8:


{{PageDescription}}
{{PageDescription}}
* The handle can come from the [[_OPENHOST]], [[OPENCLIENT]] or [[_OPENCONNECTION]] QB64 TCP/IP functions.
* The handle can come from the [[_OPENHOST]], [[OPENCLIENT]] or [[_OPENCONNECTION]].
* Returns -1 if still connected or 0 if connection has ended/failed.  
* Returns -1 if still connected or 0 if connection has ended/failed.
* Do not rely solely on this function to check for ending communication.
* Do not rely solely on this function to check for ending communication.
* Use "time-out" checking as well and [[CLOSE]] any suspect connections.
* Use "time-out" checking as well and [[CLOSE]] any suspect connections.
* If this function indicates the handle is not connected, any unread messages can still be read using [[GET (TCP/IP statement)|GET #]].
* If this function indicates the handle is not connected, any unread messages can still be read using [[GET (TCP/IP statement)|GET #]].
* Even if this function indicates the handle is not connected, it is important to [[CLOSE]] the connection anyway or important resources cannot be reallocated.  
* Even if this function indicates the handle is not connected, it is important to [[CLOSE]] the connection anyway or important resources cannot be reallocated.
 


{{PageSeeAlso}}
{{PageSeeAlso}}
* [[_OPENCONNECTION]]
* [[_OPENCONNECTION]], [[_CONNECTIONADDRESS$]]
* [[_OPENHOST]]
* [[_OPENHOST]], [[_OPENCLIENT]]
* [[_OPENCLIENT]]
* [[_CONNECTIONADDRESS$]]
* [[Downloading Files]]
* [[Downloading Files]]




{{PageNavigation}}
{{PageNavigation}}

Latest revision as of 01:17, 23 January 2023

The _CONNECTED function returns the status of a TCP/IP or HTTP connection handle.


Syntax

result& = _CONNECTED(connectionHandle&)


Description

  • The handle can come from the _OPENHOST, OPENCLIENT or _OPENCONNECTION.
  • Returns -1 if still connected or 0 if connection has ended/failed.
  • Do not rely solely on this function to check for ending communication.
  • Use "time-out" checking as well and CLOSE any suspect connections.
  • If this function indicates the handle is not connected, any unread messages can still be read using GET #.
  • Even if this function indicates the handle is not connected, it is important to CLOSE the connection anyway or important resources cannot be reallocated.


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link