Table of Contents
stream_listen
Establishes a server stream which listens on the given URI.
Description
This function establishes a server stream which listens on the given URI. The URI specifies the protocol, address, port and options associated with the server stream. The Stream API uses the protocol to load a protocol-specific driver. For example:
tcpip://localhost:17000 |
- |
listen on port 17000 using TCP/IP |
shmem://mymemory:1?bufsize=8192 |
- |
listen via shared memory buffer. Use 8K buffers by default. |
pipe:mypipe?bufsize=4096 |
- |
listen via a named pipe. Use 4K buffers for the pipe. |
Prototype
t_error stream_listen(const char * uri, t_boolean non_blocking, t_stream * server_stream);
Parameters
const char * uri
A URI indicating the stream on which to listen.
t_boolean non_blocking
Set to true (1) to prevent stream_accept calls from blocking.
t_stream * server_stream
A pointer to a t_stream variable in which the server stream handle will be stored.
Return value
Returns 0 on success. If an error occurs then a negative error code is returned.
Error codes
QERR_NON_BLOCKING_NOT_SUPPORTED
Non-blocking mode is not supported by the selected protocol.
Requirements
Include Files |
Libraries |
---|---|
quanser_stream.h |
quanser_communications.lib;quanser_runtime.lib;quanser_common.lib |
Examples
const char uri[] = "shmem://foobar:1"; const t_boolean nonblocking = true; t_stream server; result = stream_listen(uri, nonblocking, &server); if (result == 0) { ... }
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.