Code AardioLine:52复制
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.44.45.46.47.48.49.50.51.52.import
win
.ui;var
winform = win
.form(text="aardio form"
;right=759
;bottom=469
)- winform.add(
- button={cls=
"button"
;text="Button"
;left=128
;top=104
;right=272
;bottom=144
;z=1
} - )
import
hpsocket.tcpServer;var
server = hpsocket.tcpServer();- server.start(
"192.168.1.143"
,6003
); - server.onThreadCreated =
function
(){ -
- }
- server.onThreadEnd =
function
(){ -
- }
- server.onPrepareListen =
function
(hpTcpServer,soListen){ -
- }
- server.onAccept =
function
(hpTcpServer,connId,pClient){ -
- }
- server.onHandShake =
function
(hpTcpServer,connId,pClient){ -
- }
- server.onSend =
function
(hpTcpServer,connId,pData,length){ -
var
data = ..raw
.tostring
(pData,1
,length) -
- }
- server.onReceive =
function
(hpTcpServer,connId,pData,length){ -
var
data = ..raw
.tostring
(pData,1
,length) -
-
import
console; - console.dump(connId,data)
- }
- server.onClose =
function
(hpTcpServer,connId,enOperation,errCode){ -
- }
- server.onShutdown =
function
(hpTcpServer){ -
- }
- winform.button.oncommand =
function
(id,event){ -
- }
- winform.show();
win
.loopMessage();
Code AardioLine:71复制
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.44.45.46.47.48.49.50.51.52.53.54.55.56.57.58.59.60.61.62.63.64.65.66.67.68.69.70.71.import
win
.ui;var
winform = win
.form(text="aardio form"
;right=759
;bottom=469
)- winform.add(
- button={cls=
"button"
;text="Button"
;left=112
;top=72
;right=224
;bottom=112
;z=1
} - )
import
hpsocket.tcpClient;var
client = hpsocket.tcpClient()- client.start(
"192.168.1.143"
,6003
,true
); - client.onThreadCreated =
function
(){ -
-
import
console; - ..console.log(
"连接成功"
) - }
- client.onThreadEnd =
function
(){ -
-
import
console; - ..console.log(
"连接成功"
) - }
- client.onPrepareConnect =
function
(hpTcpClient,connId,soListen){ -
-
import
console; - ..console.log(
"连接成功"
) - }
- client.onHandShake =
function
(hpTcpClient,connId){ -
-
import
console; - ..console.log(
"连接成功"
) - }
- client.onSend =
function
(hpTcpClient,connId,pData,length){ -
var
data = ..raw
.tostring
(pData,1
,length) -
-
- }
- client.onConnect =
function
(hpTcpClient,connId){ -
- }
- client.onReceive =
function
(hpTcpClient,connId,pData,length){ -
var
data = ..raw
.tostring
(pData,1
,length) -
import
console; - ..console.dump(data)
-
- }
- client.onClose =
function
(hpTcpClient,connId,enOperation,errCode){ -
- }
- client.onShutdown =
function
(hpTcpClient){ -
- }
- winform.button.oncommand =
function
(id,event){ - client.send(
raw
.buffer("123"
)) - }
- winform.show();
win
.loopMessage();