On 01/07/2014 13:37, Param Jeet wrote:
I am trying to create socket connection in R.

That is not a 'socket connection'. I suggest you use one instead: see ?socketConnection.


     socket <- make.socket("localhost",2099,T,T)
     msg2<-'function=subscribe|item=MI.EQCON.1|schema=last_price;ask;bid'
     write.socket(socket,msg2)
     read.socket(socket,252,FALSE)

When I run the read.socket line, I get error:

     Error in read.socket(socket, 252, FALSE) :
     embedded nul in string:
'þþ-\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\001\0\004\0CTCL\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'

I am Unable to solve this problem. Please advice how to get rid of this
issue.

The help says

     ‘read.socket’ reads a string from the specified socket,

'Strings' do not have embedded nulls: you need something which can do binary reads. For that you need to use connections.



Regards,

        [[alternative HTML version deleted]]



______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
Brian D. Ripley,                  [email protected]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to