[Rd] Tcl socket server (tcltk) does not work any more on R 4.3.2

webmail.gandi.net phgro@je@n @end|ng |rom @c|v|ew@@org
Tue Feb 20 12:27:35 CET 2024


Dear list,

It seems that something changed between R 4.2.3 and R 4.3 (tested with 4.3.2) that broke the Tcl socket server. Here is a reproducible example:

- R process #1 (Tcl socket server):

library(tcltk)
cmd <- r"(
 proc accept {chan addr port} {         ;# Make a proc to accept connections
   puts "$addr:$port says [gets $chan]" ;# Receive a string
   puts $chan goodbye                   ;# Send a string
   close $chan                          ;# Close the socket (automatically flushes)
}                                       ;#
socket -server accept 12345             ;# Create a server socket)"
.Tcl(cmd)

- R process #2 (socket client):

con <- socketConnection(host = "localhost", port = 12345, blocking = FALSE)
writeLines("Hello, world!", con) # Should print something in R #1 stdout
readLines(con) # Should receive "goodbye"
close(con)

When R process #1 is R 4.2.3, it works as expected (whatever version of R #2). When R process #1 is R 4.3.2, nothing is sent or received through the socket apparently, but no error is issued and process #2 seems to be able to connect to the socket.

I am stuck with this. Thanks in advance for help.

Regards,

Philippe

> .Tcl("puts [info patchlevel]")
8.6.13
<Tcl>  

> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.2.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/Brussels
tzcode source: internal

attached base packages:
[1] tcltk     stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.3.2 tools_4.3.2    glue_1.7.0  


More information about the R-devel mailing list