/// <summary> /// Updates the send result. /// </summary> /// <param name="result">The result of sending the message.</param> internal void MessageSent(SendResults result) { lock (_lockObject) { _sendResult = result; _progress = MessageSendProgress.Completed; } }
bool IPhotonApplicationSink.BroadcastEvent(IPhotonPeer[] peerList, byte[] data, MessageReliablity reliability, byte channelId, MessageContentType messageContentType, out SendResults[] results) { results = new SendResults[peerList.Length]; for (int i = 0; i < peerList.Length; i++) { results[i] = peerList[i].Send(data, reliability, channelId, messageContentType); } return(true); }
public bool BroadcastEvent(IPhotonPeer[] peerList, byte[] data, MessageReliablity reliability, byte channelId, MessageContentType messageContentType, out SendResults[] results) { results = new SendResults[peerList.Length]; for (int i = 0; i < peerList.Length; i++) { results[i] = peerList[i].Send(data, reliability, channelId, messageContentType); } return true; }
public void Application_OnOutboundConnectionEstablished(IPhotonPeer peer) { lock (this.syncRoot) { this.photonPeer = peer; } if (peer.GetListenerType() != ListenerType.WebSocketListener) { if (log.IsDebugEnabled) { log.Debug("OnOutboundConnectionEstablished: sending init request"); } byte[] data = this.protocol.SerializeInitRequest(this.appName, Versions.TcpOutboundPeerVersion); SendResults results = peer.Send(data, MessageReliablity.Reliable, 0, MessageContentType.Binary); LogInitRequest(peer, 0, data, (SendResult)results); } }
/// <summary> /// Send an email using SMTP /// </summary> /// <param name="msg">System.Net.Mail.MailMessageobject</param> /// <returns>SendResults object with the results of the send operation, including errors if any</returns> public SendResults SendEmail(System.Net.Mail.MailMessage msg) { try { SendResults results = new SendResults(); msg.From = new MailAddress(_smtpServer.SendFromEmailAddress); SmtpClient smtpClient = new SmtpClient(_smtpServer.ServerUrl, _smtpServer.SmtpPort); smtpClient.EnableSsl = true; smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; if (_smtpServer.UseToken) { smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = new NetworkCredential(_smtpServer.SendFromEmailAddress, _smtpServer.AuthenticationToken); } else { smtpClient.Credentials = new NetworkCredential(_smtpServer.AuthenticationUserName, _smtpServer.AuthenticationPassword); } smtpClient.Send(msg); results.Message = msg; } catch (SmtpException ex) { _sendResults.ErrorsOccurred = true; _sendResults.ResultsMessage += "Exception caught: " + Utility.ExceptionToString(ex, true); } catch (Exception ex) { _sendResults.ErrorsOccurred = true; _sendResults.ResultsMessage += "Exception caught: " + Utility.ExceptionToString(ex, true); } _sendResults.ResultsMessage = "Email message sent."; _sendResults.SendDate = System.DateTime.UtcNow; return(_sendResults); }
/// <summary> /// Sets the send result. /// </summary> /// <param name="result">The result to set it to.</param> public void SetMessageSendResult(SendResults result) { if (_sendResult != null) { _sendResult.MessageSent(result); } if (_responseResult != null) { _responseResult.MessageSent(result); } }
/// <summary> /// Updates the send result. /// </summary> /// <param name="result">The result of sending the message.</param> internal void MessageSent(SendResults result) { lock (_lockObject) { _sendResult = result; if (result != SendResults.Success) { _responseResult = ResponseResults.ConnectionFailure; _progress = MessageResponseProgress.Completed; } else { _progress = MessageResponseProgress.WaitingForResponse; } } }