public UdpDatagram(UdpDatagramType notice, string filePath, string FromAddr, string ToAddr) { Type = notice; FromAddress = FromAddr; ToAddress = ToAddr; HostName = Dns.GetHostName(); Message = filePath; }
/// <summary> /// Send the file transfer related notice to a recipient /// </summary> /// <param name="notice">FSendReq,FAccept,FRefuse</param> /// <param name="filePath">Sending file path</param> /// <param name="recIP">Recipient IP address</param> public void SendFileNotice(UdpDatagramType notice, string filePath, IPAddress recIP) { IPEndPoint recEP = new IPEndPoint(recIP, udport); udpSender.SendMessage(new UdpDatagram(notice, filePath, LocalIPAddress.ToString(), recIP.ToString()), recEP); }
/// <summary> /// Multicast the UDP notice /// </summary> /// <param name="notice">OnLine,OffLine</param> public void MultiCastNotice(UdpDatagramType notice) { IPEndPoint groupEP = new IPEndPoint(GroupIPAddress, udport); udpSender.MultiCast(new UdpDatagram(notice, "", LocalIPAddress.ToString(), GroupIPAddress.ToString()), groupEP); }