Hi All,
Not able to make the below code work. Getting Error in readLines(serverPipe) : invalid connection.
Please help.
serverPipe <- pipe("\\\\.\\pipe\\mserver", open = 'r', "UTF-8")
if (serverPipe)
{
print(serverPipe)
while(TRUE)
{
Sys.sleep(1)
message <- readLines(serverPipe)
if(length(message)) print(message, stdout())
if(all(message == "client closing"))
{
close(serverPipe)
}
}
}
Hi!
To help us help you, could you please prepare a repr oducible ex ample (reprex) illustrating your issue and provide a little more information about what are you trying to achieve with this code? Please have a look at this guide, to see how to create a reprex:
A minimal reproducible example consists of the following items:
A minimal dataset, necessary to reproduce the issue
The minimal runnable code necessary to reproduce the issue, which can be run
on the given dataset, and including the necessary information on the used packages.
Let's quickly go over each one of these with examples:
Minimal Dataset (Sample Data)
You need to provide a data frame that is small enough to be (reasonably) pasted on a post, but big enough to reproduce your issue.
Let's say, as an example, that you are working with the iris data frame
head(iris)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.1 3.5 1.4 0.…
Hi,
Thanks for letting me know how to post here.
Regards
Hi,
I am trying to open a named pipe connection on Windows 7 and it is not working. Please help.
serverPipe <- pipe("\\\\.\\pipe\\mserver", open = 'r', "UTF-16")
if (serverPipe)
{
print(serverPipe)
str(serverPipe)
message <- ""
while(TRUE)
{
Sys.sleep(1)
message <- readLines(serverPipe)
if(length(message)) print(message)
if(all(message == "client closing"))
{
close(serverPipe)
}
}
}
#> A connection with
#> description "\\\\.\\pipe\\mserver"
#> class "pipe"
#> mode "r"
#> text "text"
#> opened "opened"
#> can read "yes"
#> can write "no"
#> 'pipe' int 4
#> - attr(*, "conn_id")=<externalptr>
#> Warning in readLines(serverPipe): line 1 appears to contain an embedded nul
#> Error in readLines(serverPipe): invalid connection
Created on 2019-05-27 by the reprex package (v0.3.0)
system
Closed
June 17, 2019, 5:33am
5
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.