//use funciton isConnected to judge if the tcp connection is available
public bool isConnected(Socket socket)
{
try{
if( socket.Connected && socket.Poll( 0, SelectMode.SelectRead ) )
{
byte[] msg = new byte[ 1 ];
if( socket.Receive( msg, 0, 1, SocketFlags.Peek ) != 0 )
return true;
else
return false;
}
}
catch( SocketException e )
{
string expMsg = "错误信息:\n" + e.ToString();
MessageBox.Show( expMsg, "socket状态检查出错..." );
}
return socket.Connected;
}
分享到:
相关推荐
VB下的MODBUS TCP通讯测软件,读写功能 01,02,03,04功能
Conection of tcp/ip using indy components with delphi 7
Connected Component Labeling
照湖南大学一篇硕士论文上做的.simulink光伏并网逆变器仿真
电力系统 100kw 分布式太阳能接电网 详细的matlab图 我自己实验用的 能给你直观的认识 太阳能电池板与电网的连接
grid connected three phases photovoltaique
python code to do connected component labeling of the thresholded image
three grid-connected inverter homework three
pv three phase grid connected system
Test_and_Learn_Securing_Connected_Products_and_Services 区块链 安全架构 安全管理 解决方案 安全开发
this is model of wind turbine, and doubly fed induction generator, connected to distribution grid
This concept covers both grid-connected and island operations.
ar_idc_hybrid_infrastructure_and_connected_ecosystems_en_may2021 (2).pdf
PV grid mppt : this will help you to understand the model of MPPT grid connected
this file is a simulation for grid connected photovoltaic
该示例程序演示了如何进入EM... 时可以看到LCD上显示"TCP connected",然后TCP/UP测试工具上会显示有1000个byte的数据接收到,另外如果您通过PC向 外发送数据,MDV-STM32-107评估板会通过EM380C将收到的数据返回给PC。
三相并网系统,包括锁相环,坐标变换,解耦控制等算法,通过验证
Grid connected pv system.
JLinkARM.dll_V6.98c_替换解决报错(解决The connected J-Link is defective)
Three_phase_Grid_Connected_PVsystem_synch_with_grid