Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

勘误5.4.5排版问题 - client.r文件代码 #4

Open
bsspirit opened this issue Mar 19, 2015 · 0 comments
Open

勘误5.4.5排版问题 - client.r文件代码 #4

bsspirit opened this issue Mar 19, 2015 · 0 comments

Comments

@bsspirit
Copy link
Owner

client.r文件代码

~ vi client.r
library(websockets)    #加载类库
client = websocket("ws://192.168.1.201",port=7681)   #创建客户端实例
rece<-function(DATA, WS, HEADER) {   D=''   if(is.raw(DATA)){     cat("raw data")     D = rawToChar(DATA)   }   cat("==>",D,"\n")}   #监听receive
set_callback("receive",rece, client)
websocket_write("2222", client)   #向服务器发请求
service(client)    #输出服务器的返回值
websocket_close(client)    #关闭连接

代码没换行,改为:

library(websockets)    #加载类库
client = websocket("ws://192.168.1.201",port=7681)   #创建客户端实例
rece<-function(DATA, WS, HEADER) {   
    D=''   
    if(is.raw(DATA)){     
        cat("raw data")     
        D = rawToChar(DATA)   
    }   
    cat("==>",D,"\n")
}   
set_callback("receive",rece, client)  #监听receive
websocket_write("2222", client)   #向服务器发请求
service(client)    #输出服务器的返回值
websocket_close(client)    #关闭连接
}
@bsspirit bsspirit changed the title 勘误5.4.5排版问题 勘误5.4.5排版问题 - client.r文件代码 Mar 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant