Problem with startSocketServer

Help
2014-02-05
2014-03-03
  • Francisco Velasco

    I've learnt that after version Tinn-R 3 is not necessary to configure R for Tinn-R, so it took me a while to get rid of the block pasted in Rprofile.site by previous versions. I've installed the new version of Tinn-R without those, but I keep on getting an error at the end of start-up Rterm: Error in structure(.External(.C_dotTcl, ...), class = "tclObj") :
    [tcl] couldn't open socket: address already in use.
    Now the svSocket package is not loaded in Rprofile.site, but obviously it is loaded, I think as part of the Tinn-R start up.
    I'm using Tinn-R 3.0.3.2 and R 3.0.2.
    Thanks for help and for the great program.
    Fran

     
  • jcfaria

    jcfaria - 2014-02-05

    Hello Francisco,

    It is the first time it is reported.

    Try the below:
    1- Make sure that all prior script generated by Tinn-R (or by you manually) in the file Rprofile.site (folder "etc" where your R is installed) was commented or removed;

    2- Close Tinn-R (if running);

    3- Start Rgui.exe (The Tinn-R should not be running);

    4- From the main menu of Rgui choice: Packages/Update packages and wait to finish the process;

    5- Start Tinn-R.

    Let me know the result.

    HTH,
    J.C.Faria

     
  • Francisco Velasco

    Done, the only Packages updated were: deldir, lme4, party, Rcpp and sdep. After closing the Rgui I've open Tinn-R and had the same problem with Rterm about socket already in use.
    I've tried also with the Rgui (that I abandoned for Rterm when I started using Tinn-R some years ago) and here the only message is stopSocketServer(port=8889)
    with result [1] FALSE
    Packages loaded at Rgui start up are grid, lattice, survival splines and Formula
    Then attaches package Hmisc and gives warns that some functions are masked from package:base
    Truth is that both Rterm and Rgui tend to work fine, so not such a big issue.
    Thanks once more for the answer and the program.

     
  • jcfaria

    jcfaria - 2014-02-05

    Francisco,

    The proper functioning of svSocket package is critical to the new versions of Tinn-R project!

    Could you please post here:
    1 - Your Rprofile.site file (folder "etc" where your R is installed)
    2 - The messages (Rterm or Rgui) after R being started by Tinn-R

    > search()
    

    Below my results:
    R version 3.0.2 Patched (2013-10-08 r64039) -- "Frisbee Sailing"
    Copyright (C) 2013 The R Foundation for Statistical Computing
    Platform: x86_64-w64-mingw32/x64 (64-bit)

    R é um software livre e vem sem GARANTIA ALGUMA.
    Você pode redistribuí-lo sob certas circunstâncias.
    Digite 'license()' ou 'licence()' para detalhes de distribuição.
    
    R é um projeto colaborativo com muitos contribuidores.
    Digite 'contributors()' para obter mais informações e
    'citation()' para saber como citar o R ou pacotes do R em publicações.
    
    Digite 'demo()' para demonstrações, 'help()' para o sistema on-line de ajuda,
    ou 'help.start()' para abrir o sistema de ajuda em HTML no seu navegador.
    Digite 'q()' para sair do R.
    
    > source('C:/Users/jcfaria/AppData/Roaming/Tinn-R/tmp/sgInfo.R')
    
    > startSocketServer(port=8889)
    [1] TRUE
    
    > search()
     [1] ".GlobalEnv"        "package:TinnRcom"  "package:Hmisc"     "package:Formula"  
     [5] "package:survival"  "package:splines"   "package:lattice"   "package:grid"     
     [9] "package:R2HTML"    "package:formatR"   "package:svSocket"  "package:stats"    
    [13] "package:graphics"  "package:grDevices" "package:utils"     "package:datasets" 
    [17] "package:methods"   "SciViews:TempEnv"  "Autoloads"         "package:base"
    
    >
    

    Best,

     
  • Francisco Velasco

    Hello again, here they go:
    Rprofile.site:

    # Things you might want to change
    
    # options(papersize="a4")
    # options(editor="notepad")
    # options(pager="internal")
    sink(stdout(), type="message")
    
    # set the default help type
    # options(help_type="text")
      options(help_type="html")
    
    # set a site library
    # .Library.site <- file.path(chartr("\\", "/", R.home()), "site-library")
      options(repos='http://cran.es.r-project.org/') # Spain
    
    # set a CRAN mirror
    # local({r <- getOption("repos")
    #       r["CRAN"] <- "http://my.local.cran"
    #       options(repos=r)})
    
    # Give a fortune cookie, but only to interactive sessions
    # (This would need the fortunes package to be installed.)
    #  if (interactive()) 
    #    fortunes::fortune()
    
    # library(base)
    # library(CampR)
    # data(CampR)
    

    message after starting R

    R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
    Copyright (C) 2013 The R Foundation for Statistical Computing
    Platform: i386-w64-mingw32/i386 (32-bit)
    
    R is free software and comes with ABSOLUTELY NO WARRANTY.
    You are welcome to redistribute it under certain conditions.
    Type 'license()' or 'licence()' for distribution details.
    
    R is a collaborative project with many contributors.
    Type 'contributors()' for more information and
    'citation()' on how to cite R or R packages in publications.
    
    Type 'demo()' for some demos, 'help()' for on-line help, or
    'help.start()' for an HTML browser interface to help.
    Type 'q()' to quit R.
    [Previously saved workspace restored]
    
    > source('C:/Users/fran/AppData/Roaming/Tinn-R/tmp/sgInfo.R')
    Loading required package: grid
    Loading required package: lattice
    Loading required package: survival
    Loading required package: splines
    Loading required package: Formula
    
    Attaching package: 'Hmisc'
    
    The following objects are masked from 'package:base':
    
        format.pval, round.POSIXt, trunc.POSIXt, units
    
    > startSocketServer(port=8889)
    Error in structure(.External(.C_dotTcl, ...), class = "tclObj") : 
      [tcl] couldn't open socket: address already in use.
    

    Search()

     [1] ".GlobalEnv"        "package:TinnRcom"  "package:Hmisc"     "package:Formula"   "package:survival"  "package:splines"   "package:lattice"  
     [8] "package:grid"      "package:R2HTML"    "package:formatR"   "package:svSocket"  "package:stats"     "package:graphics"  "package:grDevices"
    [15] "package:utils"     "package:datasets"  "package:methods"   "SciViews:TempEnv"  "Autoloads"         "package:base"
    

    After comparing both results I think I've found the difference, the sink() function that I used to redirect errors to Rterm I/O screen, which was much more convenient than having to change to the other screen...
    Could it be that that's the problem?
    Checked and yes, that's it, after removing the sink function I got the 8889 socket open and free.
    Sorry for the mess and thanks for help and program.
    F.

     
    Last edit: jcfaria 2014-02-05
  • jcfaria

    jcfaria - 2014-02-05

    Francisco,

    I think the problem is elsewhere, possibly Windows permission to use port 8889.

    Generally Windows sends a message requesting authorization to Tinn-R program using this port.

    I make my Rprofile.site like below:

    # Things you might want to change
    
    # options(papersize="a4")
    # options(editor="notepad")
    # options(pager="internal")
    
    # set the default help type
    # options(help_type="text")
      options(help_type="html")
    
    # set a site library
    # .Library.site <- file.path(chartr("\\", "/", R.home()), "site-library")
    
    # set a CRAN mirror
    # local({r <- getOption("repos")
    #       r["CRAN"] <- "http://my.local.cran"
    #       options(repos=r)})
    
    # Give a fortune cookie, but only to interactive sessions
    # (This would need the fortunes package to be installed.)
    #  if (interactive()) 
    #    fortunes::fortune()
    
    # options('editor'='C:/Tinn-R/bin/Tinn-R.exe')
    
    # Francisco options:
    sink(stdout(), type="message")
    options(repos='http://cran.es.r-project.org/')
    

    My startup messages from R (Rterm):

    R version 3.0.2 Patched (2013-10-08 r64039) -- "Frisbee Sailing"
    Copyright (C) 2013 The R Foundation for Statistical Computing
    Platform: x86_64-w64-mingw32/x64 (64-bit)
    
    R é um software livre e vem sem GARANTIA ALGUMA.
    Você pode redistribuí-lo sob certas circunstâncias.
    Digite 'license()' ou 'licence()' para detalhes de distribuição.
    
    R é um projeto colaborativo com muitos contribuidores.
    Digite 'contributors()' para obter mais informações e
    'citation()' para saber como citar o R ou pacotes do R em publicações.
    
    Digite 'demo()' para demonstrações, 'help()' para o sistema on-line de ajuda,
    ou 'help.start()' para abrir o sistema de ajuda em HTML no seu navegador.
    Digite 'q()' para sair do R.
    
    > source('C:/Users/jcfaria/AppData/Roaming/Tinn-R/tmp/sgInfo.R')
    Carregando pacotes exigidos: grid
    Carregando pacotes exigidos: lattice
    Carregando pacotes exigidos: survival
    Carregando pacotes exigidos: splines
    Carregando pacotes exigidos: Formula
    
    Attaching package: 'Hmisc'
    
    The following objects are masked from 'package:base':
    
        format.pval, round.POSIXt, trunc.POSIXt, units
    
    > startSocketServer(port=8889)
    [1] TRUE
    
    > Francisco #an innocent prank
    Erro: objeto 'Francisco' não encontrado
    
    >
    

    I did not know this feature of the sink to redirect stderror to stdout!

    sink(stdout(), type="message")
    

    I found it very interesting and I'll add in the project documentation in the next release (3.0.3.4).

    We have been working hard to optimize the Rterm interface. It is much faster and efficient in the latest version of the Tinn-R project (3.0.3.3) released today.

    For not too heavy tasks, I prefer using Rterm because it is much more interactive. For very heavy tasks I also prefer to use Rgui.

    P.S:
    - I've reformatted your messages to the markdown syntax, because they were not legible. ;)

    All the best,
    J.C.Faria

     
    Last edit: jcfaria 2014-02-05
  • Francisco Velasco

    Well it's true that it was not so simple, and your markdown formatting made it simply legible, now I have something else to learn, but will leave it for the next day...
    I've been playing around and keep on having the same error from the socket, and the truth was that in Rterm is didn't show up because it was redirected to the log window.
    I've found also that sometimes I'm getting another error, this with its own window Error (windows format):


    Error: 10061
    R is not in server mode.
    Please, start R and/or run the startSocketServer() function available in the svSocket package!, and OK button to close the error window.


    After starting svSocket library and running the startSocket function I had again the socket error: address already in use....
    So I'll see if it gets better with the new 3.0.3.3 version of this great program. Glad that at least I could show the sink function that I find really useful when working with Rterm.
    Best.

     
    Last edit: Francisco Velasco 2014-02-05
  • jcfaria

    jcfaria - 2014-02-05

    Dear Francisco,

    Well, the problem seems to be located and is relative to svSocket package.

    It would be interesting to test the functions of the package on your machine in the absence of Tinn-R.

    If the problem persists, I recommend contacting the maintainer of the package svScoket: Philippe Grosjean.

    All the best,
    J.C.Faria

     
    Last edit: jcfaria 2014-02-06
  • Francisco Velasco

    That's what I'll do.
    Thanks a lot and
    Best

     
  • Francisco Velasco

    After consulting with Philippe Grosjean he proposed simply changing the Socket and that has solved the problem, so that's it.
    Thanks

     
    • jcfaria

      jcfaria - 2014-02-07

      Good news!

      All the best,
      J.C.Faria

       
      Last edit: jcfaria 2014-02-07
    • Jacob

      Jacob - 2014-03-01

      Hi Francisco I am encountering the same problem. Can you tell me where you changed the socket setting?

      THanks!

       
      • jcfaria

        jcfaria - 2014-03-01

        Jacob,

        I recommend contacting the maintainer of the package svScoket: Philippe Grosjean (phgrosjean@sciviews.org).

        All the best,
        J.C.Faria

         
  • Francisco Velasco

    Hi Jacob,
    I changed the socket in Tinn-R menu: R->Start/Close and connections->Server connections and tests. In the configuration window you have the option to coinfigur the local host IP and port, that was the port I changed to 8810. And this one worked fine for me. You can configure it also within Options->application->R server.
    But of course you can contact Philippe.
    hth
    Best
    Fran

     
    Last edit: Francisco Velasco 2014-03-03
    • jcfaria

      jcfaria - 2014-03-03

      There is the same option at: Opions/Application/R/R server.

      HTH,
      ///\\///\\///\\///\\///\\///\\///\\///\\ Jose Claudio Faria
      Estatistica
      UESC/DCET/Brasil
      joseclaudio.faria at gmail.com
      Telefones:
      55(73)3680.5545 - UESC
      55(73)9966.9100 - VIVO
      55(73)9100.7351 - TIM
      55(73)8817.6159 - OI
      ///\\///\\///\\///\\///\\///\\///\\///\\

      On Mon, Mar 3, 2014 at 5:53 AM, Francisco Velasco fvgls@users.sf.net wrote:

      Hi Jacob,
      I changed the socket in Tinn-R menu: R->Start/Close and connections->Server
      connections and tests. In the configuration window you have the option to
      coinfigur the local host IP and port, that was the port I changed to 8810.
      And this one worked fine for me. You can configure it also within
      Options->application->R server.
      hth
      Best
      Fran


      Problem with startSocketServer


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/tinn-r/discussion/481901/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
  • jcfaria

    jcfaria - 2014-03-03

    There is the same option at: Options/Application/R/R server.

    HTH,
    J.C.Faria

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks