I am trying to read multiple lines in from a TCP web socket. When I run the following lines one at a time in the RStudio console, I get the data in the expected values and format. When I try to run them together (as part of a larger script or simply by entering both into the console before hitting enter), the NMEA_bulk object reads "character(0)".
Scon <- socketConnection("127.0.0.1", port = 55555)
NMEA_bulk <- readLines(Scon, n = 18)
Can someone explain this issue to me? What is the work around?