diff options
author | TinWoodman92 <chrhodgden@gmail.com> | 2023-06-11 20:49:16 -0500 |
---|---|---|
committer | TinWoodman92 <chrhodgden@gmail.com> | 2023-06-11 20:49:16 -0500 |
commit | 48fbc07e1106f217e56dba99d273946d39de5974 (patch) | |
tree | 617c1b82b45d0031c67cc3a7ec29136fc0494320 /source_file.r | |
parent | 2a1a16a22e44ae35b8fab3ac462b49d3be87d01f (diff) |
Updated launcher and script to use the dialoguer package.
Diffstat (limited to 'source_file.r')
-rw-r--r-- | source_file.r | 49 |
1 files changed, 2 insertions, 47 deletions
diff --git a/source_file.r b/source_file.r index ce7e85d..3d13503 100644 --- a/source_file.r +++ b/source_file.r @@ -1,47 +1,2 @@ -HEADER <- 64 -PORT <- 6011 -SERVER <- "localhost" -FORMAT <- "utf-8" -DISCONNECT_MESSAGE <- "!DISSCONNECT" - -con <- socketConnection( - host = SERVER, - port = PORT, - server = FALSE -) - -display_msg <- function(msg) { - cat( - '\033[94m', - msg, - sep = '', - end = '\033[0m\n' - ) -} - -send_msg <- function(conn, msg) { - sendme <- paste(msg, strrep(" ", HEADER - nchar(msg)), sep = "") - writeChar(sendme, conn) -} - -recv_msg <- function(conn) { - suppressWarnings(msg <- trimws(readChar(conn, HEADER))) - while (length(msg) == 0) { - #cat('ALERT\n') - suppressWarnings(msg <- trimws(readChar(conn, HEADER))) - } - return(msg) -} - -msg <- "Initializing Client - R" -display_msg(msg) - -msg <- "Initialized Client - R" -send_msg(con, msg) - -while (msg != '!DISCONNECT') { - msg <- recv_msg(con) - display_msg(msg) -} - -close(con)
\ No newline at end of file +msg_1 <- "Initializing Client - R" +msg_2 <- "Initialized Client - R"
\ No newline at end of file |