local tcpClient = CTNLuaTcpClient()
local sPort = 19999
local sIP = '192.168.0.147'
tcpClient:setServer(sPort, sIP);
if tcpClient:login() == true then
ui:tip('登陆成功');
end
if tcpClient:isLogin() == true then
ui:tip('已登陆');
else
ui:tip('未登录');
end
local sMsgSend = '发送至服务器的消息:测试消息'
tcpClient:sendMsg(sMsgSend);
local sXML = [[
<students>
<class a_name = "1606D">
<student>
<name>俄罗斯</name>
<age>18</age>
<sex>女</sex>
</student>
<student>
<name>张三</name>
<age>20</age>
<sex>男</sex>
</student>
<student>
<name>李四</name>
<age>33</age>
<sex>男</sex>
</student>
</class>
</students>
]]
tcpClient:sendXML(sXML, 1);
local sStrCTN = CTNString();
tcpClient:recvMsg(sStrCTN, '!', 1000);
local sGetMsg = sStrCTN:get()
print('接收到的消息:'..sGetMsg);
tcpClient:logout();