Beispiel #1
0
        async Task SendErrorResponse(Socket s, ApnsNotificationErrorStatusCode statusCode, int identifier)
        {
            Failed++;
            Successful--;

            var errorResponseData = new byte[6];
            errorResponseData[0] = 0x01;
            errorResponseData[1] = BitConverter.GetBytes((short)statusCode)[0];

            var id = BitConverter.GetBytes(IPAddress.HostToNetworkOrder(identifier));
            Buffer.BlockCopy(id, 0, errorResponseData, 2, 4);

            var sent = await s.SendAsync(new ArraySegment<byte>(errorResponseData, 0, errorResponseData.Length), SocketFlags.None);
        }
Beispiel #2
0
        void SendErrorResponse(Socket s, ApnsNotificationErrorStatusCode statusCode, int identifier)
        {
            Failed++;
            Successful--;

            var errorResponseData = new byte[6];

            errorResponseData[0] = 0x01;
            errorResponseData[1] = BitConverter.GetBytes((short)statusCode)[0];

            var id = BitConverter.GetBytes(IPAddress.HostToNetworkOrder(identifier));

            Buffer.BlockCopy(id, 0, errorResponseData, 2, 4);

            var sent = Task.Factory.FromAsync <int> (
                s.BeginSend(errorResponseData, 0, errorResponseData.Length, SocketFlags.None, null, null),
                s.EndSend).Result;
        }
Beispiel #3
0
        void SendErrorResponse(Socket s, ApnsNotificationErrorStatusCode statusCode, int identifier)
        {
            Failed++;
            Successful--;

            var errorResponseData = new byte[6];

            errorResponseData[0] = 0x01;
            errorResponseData[1] = BitConverter.GetBytes((short)statusCode)[0];

            var id = BitConverter.GetBytes(IPAddress.HostToNetworkOrder(identifier));

            Buffer.BlockCopy(id, 0, errorResponseData, 2, 4);

            throw new NotImplementedException("replace .BeginSend() and .EndSend() in dotnetcore somehow?!");
            //var sent = Task.Factory.FromAsync<int> (
            //    s.BeginSend (errorResponseData, 0, errorResponseData.Length, SocketFlags.None, null, null),
            //    s.EndSend).Result;
        }
Beispiel #4
0
 public ApnsResponseFilter(ApnsNotificationErrorStatusCode status, IsMatchDelegate isMatchHandler)
 {
     IsMatch = isMatchHandler;
     Status  = status;
 }
Beispiel #5
0
 public ApnsNotificationException(ApnsNotificationErrorStatusCode statusCode, string msg) : base(msg)
 {
     ErrorStatusCode = statusCode;
 }
Beispiel #6
0
 public ApnsNotificationException(ApnsNotificationErrorStatusCode errorStatusCode, ApnsNotification notification, Exception innerException)
     : base("Apns notification error: '" + errorStatusCode + "'", notification, innerException)
 {
     Notification    = notification;
     ErrorStatusCode = errorStatusCode;
 }
Beispiel #7
0
 public ApnsNotificationException (ApnsNotificationErrorStatusCode errorStatusCode, ApnsNotification notification, Exception innerException)
     : base ("Apns notification error: '" + errorStatusCode + "'", notification, innerException)
 {
     Notification = notification;
     ErrorStatusCode = errorStatusCode;
 }
Beispiel #8
0
 public ApnsResponseFilter (ApnsNotificationErrorStatusCode status, IsMatchDelegate isMatchHandler)
 {
     IsMatch = isMatchHandler;
     Status = status;
 }
Beispiel #9
0
 public ApnsNotificationException (ApnsNotificationErrorStatusCode statusCode, string msg) : base (msg)
 {
     ErrorStatusCode = statusCode;
 }
Beispiel #10
0
        void SendErrorResponse (Socket s, ApnsNotificationErrorStatusCode statusCode, int identifier)
        {
            Failed++;
            Successful--;

            var errorResponseData = new byte[6];
            errorResponseData[0] = 0x01;
            errorResponseData[1] = BitConverter.GetBytes ( (short)statusCode)[0];

            var id = BitConverter.GetBytes (IPAddress.HostToNetworkOrder (identifier));
            Buffer.BlockCopy (id, 0, errorResponseData, 2, 4);

            var sent = Task.Factory.FromAsync<int> (
                s.BeginSend (errorResponseData, 0, errorResponseData.Length, SocketFlags.None, null, null),
                s.EndSend).Result;
        }
Beispiel #11
0
 public ApnsNotificationException(ApnsNotificationErrorStatusCode errorStatusCode, ApnsNotification notification)
     : base($"Apns notification error: '{errorStatusCode}'")
 {
     Notification    = notification;
     ErrorStatusCode = errorStatusCode;
 }