Get-modes - Function Summary
Returns mode settings for a port.
get-modes target modes
target - The target argument. (must be: file url block port)
modes - The modes argument. (must be: word block)
This function returns a block of special modes for file and network ports. GET-MODES takes a port and a block of modes that are being requested. It returns a block of mode names and their values (which can in turn be passed back to SET-MODES).
The example above shows that the port is opened for binary access but not for direct access.
A shortcut to query a single mode is to specify a single mode word as the argument:
In this case GET-MODES only returns the value directly, rather than a block.
Another form of GET-MODES takes a name-value block that is of the same format as SET-MODES.
Here the values specified are ignored.
GET-MODES supports a few special modes which return a list of applicable modes for a port. They are: file-modes, copy-modes, network-modes, and port-modes. If any of these modes are specified in a GET-MODES request then the response contains a block of matching modes which are available on the current operating system (and it may vary between systems).
You can actually use the returned value to get the values of all available modes:
Be sure to close the port when you have completed your queries and changes:
The complete list of all modes includes (note that not all modes are supported by all operating systems. See REBOL 2.5 addendum for more information):
For example, to obtain a list of network interfaces for your computer system:
See the REBOL/Core Addendum for a complete description of GET-MODES and SET-MODES.
open - Opens a new port connection.