libgslutil
1.2.3
|
Functions | |
int | generic_open (int flags, const char *name) |
Open a streaming device based on name. More... | |
A routine which allows any streaming device (Unix streams socket, serial port, TCP connection, etc.) to be opened.
A TCP connection may be initiated with a device name of TCP:host,service
where host is a host name to resolve or an IP address, and service is a port number or service name (see ipaddr_resolve()).
A Unix streams connection may be initiated with a device name of Unix:/path/to/socket
.
A serial port may be opened with a device name of tty:/path/to/device,baud
.
int generic_open | ( | int | flags, |
const char * | name | ||
) |
Open a streaming device based on name.
flags | Flags for open/connect. |
name | Device name. |
-1 | on error (and see errno). |
Opens a generic device (see Generic open/connect routine description for explanation of the format of name). flags may contain GSL_NONBLOCK to make the stream nonblocking.
On success, returns a file descriptor for the newly-opened device/socket. On failure, sets errno and returns -1. If name does not begin with a recognised prefix, or cannot be parsed, errno is set to EINVAL
. If name resolution of a TCP connection fails, errno is set to EADDRNOTAVAIL
.