示例#1
0
文件: APNS.cs 项目: smoak/libAPNs
        public IErrorResponse SendEnhancedNotification(IEnhancedNotification enhancedNotification)
        {
            this.connection.Connect();
            this.connection.Write(enhancedNotification.ToByteArray());
            var response = new byte[6];
            this.connection.Read(response, 0, response.Length);
            this.connection.Disconnect();
            IErrorResponse errorResponse = null;

            if (response[0] == 0x08)
            {
                // we received an error response...
                errorResponse = new ErrorResponse(BitConverter.ToInt32(response, 2), (ErrorResponseStatusCode) response[1]);
            }

            return errorResponse;
        }
示例#2
0
        public IErrorResponse SendEnhancedNotification(IEnhancedNotification enhancedNotification)
        {
            this.connection.Connect();
            this.connection.Write(enhancedNotification.ToByteArray());
            var response = new byte[6];

            this.connection.Read(response, 0, response.Length);
            this.connection.Disconnect();
            IErrorResponse errorResponse = null;

            if (response[0] == 0x08)
            {
                // we received an error response...
                errorResponse = new ErrorResponse(BitConverter.ToInt32(response, 2), (ErrorResponseStatusCode)response[1]);
            }

            return(errorResponse);
        }