Пример #1
0
 /// <summary>
 /// Connects to Rserve identified by host name.
 /// </summary>
 /// <param name="hostname">
 /// Hostname of the server
 /// </param>
 /// <param name="port">
 /// Port on which Rserve listens
 /// </param>
 /// <param name="credentials">
 /// Credentials for authentication or <c>null</c> for anonymous
 /// </param>
 /// <param name="addressFamily">
 /// Optional address family when selecting IP address or <c>null</c> if any
 /// </param>
 /// <param name="timeout">
 /// Optional timeout, defaults to one second
 /// </param>
 public static RConnection Connect(
     string hostname,
     int port = 6311,
     NetworkCredential credentials = null,
     AddressFamily?addressFamily   = null,
     TimeSpan?timeout = null) =>
 Async.RunSynchronously(ConnectAsync(hostname, port, credentials, addressFamily, timeout));
Пример #2
0
 /// <summary>
 /// Attempt to shut down the server process cleanly.
 /// This command is asynchronous!
 /// </summary>
 public void ServerShutdown() => Async.RunSynchronously(ServerShutdownAsync());
Пример #3
0
 /// <summary>
 /// Write a file to the server.
 /// Note: It'd be better to return a Stream object to be written to, but Rserve doesn't seem to support an asynchronous connection
 /// for file reading and writing.
 /// </summary>
 /// <param name="fileName">
 /// Name of the file to be written. Avoid jumping across directories.
 /// </param>
 /// <param name="data">
 /// Data to be written to the file
 /// </param>
 public void WriteFile(string fileName, Stream data) =>
 Async.RunSynchronously(WriteFileAsync(fileName, data));
Пример #4
0
 /// <summary>
 /// Evaluate an R command and don't return the result (for efficiency)
 /// </summary>
 /// <param name="s">
 /// R command tp be evaluated
 /// </param>
 public void VoidEval(string s) =>
 Async.RunSynchronously(VoidEvalAsync(s));
Пример #5
0
 /// <summary>
 /// Delete a file from the server
 /// </summary>
 /// <param name="fileName">
 /// Name of the file to be deleted
 /// </param>
 public void RemoveFile(string fileName) =>
 Async.RunSynchronously(RemoveFileAsync(fileName));
Пример #6
0
 /// <summary>
 /// Read a file from the server
 /// </summary>
 /// <param name="fileName">
 /// Name of the file to be read. Avoid jumping across directories.
 /// </param>
 /// <returns>
 /// Stream with the file data.
 /// </returns>
 public Stream ReadFile(string fileName) =>
 Async.RunSynchronously(ReadFileAsync(fileName));
Пример #7
0
 /// <summary>
 /// Evaluate an R command and return the result. this[string] is syntactic sugar for the same operation.
 /// </summary>
 /// <param name="s">
 /// Command to be evaluated
 /// </param>
 /// <returns>
 /// Sexp that resulted from the command
 /// </returns>
 public Sexp Eval(string s) =>
 Async.RunSynchronously(EvalAsync(s));
Пример #8
0
 /// <summary>
 /// Assign an R variable on the server. this[symbol] = value is syntactic sugar for this operation.
 /// </summary>
 /// <param name="symbol">
 /// Variable name
 /// </param>
 /// <param name="val">
 /// Sexp to be assigned to the variable
 /// </param>
 public void Assign(string symbol, Sexp val) =>
 Async.RunSynchronously(AssignAsync(symbol, val));
Пример #9
0
 /// <summary>
 /// Connects to Rserve identified by an IP address.
 /// </summary>
 /// <param name="addr">
 /// Address of the Rserve server, or nothing for localhost
 /// </param>
 /// <param name="port">
 /// Port on which the server listens
 /// </param>
 /// <param name="credentials">
 /// Credentials for authentication or <c>null</c> for anonymous
 /// </param>
 public static RConnection Connect(IPAddress addr = null, int port = 6311, NetworkCredential credentials = null) =>
 Async.RunSynchronously(ConnectAsync(addr, port, credentials));
Пример #10
0
 /// <summary>
 /// Connects to Rserve identified by host name.
 /// </summary>
 /// <param name="hostname">
 /// Hostname of the server
 /// </param>
 /// <param name="port">
 /// Port on which Rserve listens
 /// </param>
 /// <param name="credentials">
 /// Credentials for authentication or <c>null</c> for anonymous
 /// </param>
 public static RConnection Connect(string hostname, int port = 6311, NetworkCredential credentials = null) =>
 Async.RunSynchronously(ConnectAsync(hostname, port, credentials));
Пример #11
0
 public RConnection(IPAddress addr = null, int port = 6311, string user = null, string password = null) :
     this(Async.RunSynchronously(ConnectAsync(addr, port, CreateNetworkCredential(user, password))))
 {
 }
Пример #12
0
 public RConnection(string hostname, int port = 6311, string user = null, string password = null) :
     this(Async.RunSynchronously(ConnectAsync(hostname, port, CreateNetworkCredential(user, password))))
 {
 }