File: processx_sockets.Rd

package info (click to toggle)
r-cran-processx 3.8.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,068 kB
  • sloc: ansic: 6,485; sh: 13; makefile: 2
file content (66 lines) | stat: -rw-r--r-- 2,454 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/connections.R
\name{conn_create_unix_socket}
\alias{conn_create_unix_socket}
\alias{conn_connect_unix_socket}
\alias{conn_accept_unix_socket}
\alias{conn_unix_socket_state}
\title{Unix domain sockets}
\usage{
conn_create_unix_socket(filename = NULL, encoding = "")

conn_connect_unix_socket(filename, encoding = "")

conn_accept_unix_socket(con)

conn_unix_socket_state(con)
}
\arguments{
\item{filename}{File name of the socket. On Windows it the name of the
pipe within the \verb{\\\\?\\pipe\\} namespace, either the full name, or the
part after that prefix. If \code{NULL}, then a random name
is used, on Unix in the R temporary directory: \code{\link[base:tempfile]{base::tempdir()}}.}

\item{encoding}{Encoding to assume when reading from the socket.}

\item{con}{Connection. An error is thrown if not a socket connection.}
}
\value{
A new socket connection.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}

Cross platform point-to-point inter-process communication with
Unix=domain sockets, implemented via named pipes on Windows.
These connection are always bidirectional, i.e. you can read from them
and also write to them.
}
\details{
\code{conn_create_unix_socket()} creates a server socket. The new socket
is listening at \code{filename}. See \code{filename} above.

\code{conn_connect_unix_socket()} creates a client socket and connects it to
a server socket.

\code{conn_accept_unix_socket()} accepts a client connection at a server
socket.

\code{conn_unix_socket_state()} returns the state of the socket. Currently it
can return: \code{"listening"}, \code{"connected_server"}, \code{"connected_client"}.
It is possible that other states (e.g. for a closed socket) will be added
in the future.
\subsection{Notes}{
\itemize{
\item \code{\link[=poll]{poll()}} works on sockets, but only polls for data to read, and
currently ignores the write-end of the socket.
\item \code{\link[=poll]{poll()}} also works for accepting client connections. It will return
\code{"connect"}is a client connection is available for a server socket.
After this you can call \code{conn_accept_unix_socket()} to accept the
client connection.
}
}
}
\seealso{
\href{https://processx.r-lib.org/dev/articles/internals.html}{processx internals}
}