91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 0.30M
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2024-04-25
  • 語言: C#
  • 標簽: udp通訊??UDP??DP??通訊??

資源簡介


資源截圖

代碼片段和文件信息

using?System;
using?System.IO;
using?System.Runtime.Serialization.Formatters.Binary;
using?System.Net;
using?System.Collections;

namespace?P2PCommon
{
????///??
????///?顯示跟蹤消息的事件委托?
????///?
?
????public?delegate?void?WriteLogHandle(string?msg);

????///??
????///?刷新在線用戶的事件委托?
????///?
?
????public?delegate?void?UserChangedHandle(UserCollection?users);

????public?class?Globals
????{
????????///??
????????///?服務器偵聽端口?
????????///?
?
????????public?const?int?SERVER_PORT?=?21134;

????????///??
????????///?本地偵聽端口?
????????///?
?
????????public?const?int?LOCAL_PORT?=?19786;
????}

????///??
????///?User?的摘要說明。?
????///?
?
????[Serializable]
????public?class?User
????{
????????protected?string?_userName;
????????protected?IPEndPoint?_netPoint;
????????protected?bool?_conntected;

????????public?User(string?UserName?IPEndPoint?NetPoint)
????????{
????????????this._userName?=?UserName;
????????????this._netPoint?=?NetPoint;
????????}

????????public?string?UserName
????????{
????????????get?{?return?_userName;?}
????????}

????????public?IPEndPoint?NetPoint
????????{
????????????get?{?return?_netPoint;?}
????????????set?{?_netPoint?=?value;?}
????????}

????????public?bool?IsConnected?//打洞標記
????????{
????????????get?{?return?_conntected;?}
????????????set?{?_conntected?=?value;?}
????????}

????????public?string?FullName?{?get?{?return?this.ToString();?}?}

????????public?override?string?ToString()
????????{
????????????return?_userName?+?“-?[“?+?_netPoint.Address.ToString()?+?“:“?+?_netPoint.Port.ToString()?+?“]?“?+?(_conntected???“Y“?:?“N“);
????????}
????}

????///??
????///?在線用戶列表?
????///?
?
????[Serializable]
????public?class?UserCollection?:?Collectionbase
????{
????????public?void?Add(User?user)
????????{
????????????InnerList.Add(user);
????????}

????????public?void?Remove(User?user)
????????{
????????????InnerList.Remove(user);
????????}

????????public?User?this[int?index]
????????{
????????????get?{?return?(User)InnerList[index];?}
????????}

????????public?User?Find(string?userName)
????????{
????????????foreach?(User?user?in?this)
????????????{
????????????????if?(string.Compare(userName?user.UserName?true)?==?0)
????????????????{
????????????????????return?user;
????????????????}
????????????}
????????????return?null;
????????}
????}

????///??
????///?序列化反序列化對象?
????///?
?
????public?class?objectSerializer
????{
????????public?static?byte[]?Serialize(object?obj)
????????{
????????????BinaryFormatter?binaryF?=?new?BinaryFormatter();
????????????MemoryStream?ms?=?new?MemoryStream(1024?*?10);
????????????binaryF.Serialize(ms?obj);
????????????ms.Seek(0?SeekOrigin.Begin);
????????????byte[]?buffer?=?new?byte[(int)ms.Length];
????????????ms.Read(buffer?0?buffer.Length);
????????????ms.Close(

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????7168??2016-08-23?10:17??Debug\Common.dll

?????文件??????17920??2016-08-23?10:17??Debug\Common.pdb

?????文件??????16384??2016-08-23?10:17??Debug\frmClient.exe

-----------?---------??----------?-----??----

????????????????41472????????????????????3


評論

共有 條評論