how to disconnect tcp/ip connection?

68 ビュー (過去 30 日間)
Jae-Hee Park
Jae-Hee Park 2021 年 11 月 24 日
コメント済み: Eric Delgado 2022 年 6 月 24 日
I made tcp/ip server and client like this
server = tcpserver('0.0.0.0',111);
and another app
cli = tcpclient('localhost',111);
It is perfectly connected.
So, how to disconnect TCP/IP form client?
and how to disconnect from server?

採用された回答

Harikrishnan Balachandran Nair
Harikrishnan Balachandran Nair 2021 年 12 月 3 日
Hi,
You can close the TCP/IP connection by clearing the 'tcpclient' object using the 'clear' function .
Please refer to the following documentations to get a better idea on this :
Hope this helps!
  5 件のコメント
Jae-Hee Park
Jae-Hee Park 2021 年 12 月 30 日
@chuck shen Thank you.
delete(app.client);
Above command works clear the values of app.client but do not erase the app.client.
%ex)
delete(app.client);
isa(app.client,'tcpclient'); % is true
There is no way to completely erase the app.client?
Eric Delgado
Eric Delgado 2022 年 6 月 24 日
I was dealing with the same issue, using appDesigner and create a handle (property of my app) to a tcpclient object. The new solution was the "old solution" (used in "tcpip" objects).
delete(app.client)
clear app.client
The validation isa(app.client,'tcpclient') as true is not a problem at all. You can create other tcpclient object and handling this object in "app.client".

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by