Skip to content

Instantly share code, notes, and snippets.

@corynissen
Last active July 19, 2016 15:47
Show Gist options
  • Save corynissen/5659919 to your computer and use it in GitHub Desktop.
Save corynissen/5659919 to your computer and use it in GitHub Desktop.
R socket server
server <- function(){
while(TRUE){
writeLines("Listening...")
con <- socketConnection(host="localhost", port = 6011, blocking=TRUE,
server=TRUE, open="r+")
data <- readLines(con, 1)
print(data)
response <- toupper(data)
writeLines(response, con)
close(con)
}
}
server()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment