When I open a socketConnection in R with the following code
con <- socketConnection(adress = my_adress, port = my_port, server=FALSE, open="r+b")
how can I close it again? Here is a list of functions which I already tried (in the comment behind each function is written why it did not work):
close(con) #Nothing happens or Error in close.connection(con) : invalid connection
con.close() #Error in con.close() : could not find function "con.close"
close.connection(con) #Nothing happens or Error in close.connection(con) : invalid connection
closeAllConnections() #Nothing happens
closeSocketClients() #Error in closeSocketClients() : could not find function "closeSocketClients"
unlink(con) #Nothing happens
on.exit(con) #Nothing happens
on.exit(socketConnection) #Nothing happens
close.socket(con) #Error: $ operator is invalid for atomic vectors
rm(con) #Only removes it from the workspace, does not really close it
close(con) and close.connection(con) seem to do something, since "Nothing happens" is when I do it the first time after opening the connection and "Error..." is afterwards.
But the reason, why I am quite sure that none of the functions above really work, are messages like this:
Warning message:
In packFrameName(frame) : closing unused connection 3 (->IP-Adress:Port)