维护通信双方之间的网络连接,判断通信客户是否正常在线!
接受:
case "Bit":
string ipAndport = splitString[1].Trim() + ":" + splitString[2].Trim();
BitUpdate(ipAndport);
break;
发送:
private delegate void BitUpdateDele(string ipAndport);
/// <summary>
/// 收到Bit包,修改心跳包标志为0
/// </summary>
private void BitUpdate(string ipAndport)
{
if (lvwUser.InvokeRequired)
{
BitUpdateDele d = BitUpdate;
lvwUser.Invoke(d, ipAndport);
}
else
{
for (int i = 0; i < lvwUser.Items.Count; i++)
{
if (lvwUser.Items[i].SubItems[1].Text == ipAndport)
{
lvwUser.Items