Exemple #1
0
        void Server_Started(object sender, AsyncUdpEventArgs e)
        {
            CastReceiver cr = sender as CastReceiver;

            WriteLog($"伺服器已於 {cr.LocalEndPort} 啟動");
            WriteLog("已加入監聽的群組:");
            foreach (System.Net.Sockets.MulticastOption mo in cr.JoinedGroups)
            {
                WriteLog($"-> {mo.Group}");
            }
        }
Exemple #2
0
 void Server_DataReceived(object sender, AsyncUdpEventArgs e)
 {
     WriteLog("收到資料({0}->{1}) {2} Bytes", e.RemoteEndPoint, e.LocalEndPoint, e.Data.Length);
     WriteLog(" > : {0}", Encoding.Default.GetString(e.Data));
     WriteLog("Hex: {0}", e.Data.ToHexString());
 }
Exemple #3
0
 void Server_Shutdowned(object sender, AsyncUdpEventArgs e)
 {
     WriteLog("伺服器已關閉");
 }
Exemple #4
0
 void Client_DataSended(object sender, AsyncUdpEventArgs e)
 {
     WriteLog("發送資料 {0} Bytes", e.Data.Length);
     WriteLog(" < : {0}", Encoding.Default.GetString(e.Data));
     WriteLog("Hex: {0}", e.Data.ToHexString());
 }
Exemple #5
0
 void Server_OnDataReceived(object sender, AsyncUdpEventArgs e)
 {
     WriteLog("收到資料 {0} Bytes 來自 {1}", e.Data.Length, e.RemoteEndPoint);
     WriteLog(" > : {0}", Encoding.Default.GetString(e.Data));
     WriteLog("Hex: {0}", e.Data.ToHexString());
 }
Exemple #6
0
 void Server_OnException(object sender, AsyncUdpEventArgs e)
 {
     WriteLog("M:伺服器發生錯誤:{0}", e.Exception.Message);
 }
Exemple #7
0
 void Server_OnStarted(object sender, AsyncUdpEventArgs e)
 {
     WriteLog("M:伺服器已於 {0} 啟動", _Server.Socket.LocalEndPoint);
 }
Exemple #8
0
 void Server_OnShutdown(object sender, AsyncUdpEventArgs e)
 {
     WriteLog("M:伺服器已關閉");
 }