Push notification

This is the place for queries that don't fit in any of the other categories.

Push notification

Postby Nuber2Py » Wed Apr 16, 2014 7:57 pm

I am trying to follow the example at this location http://nthn.me/posts/2012/push.html and i did not understand what this line of code does

Code: Select all
fmt = '!cH32sH{0:d}s'.format(len(payload))


If anyone can please help me understand it I would really appreciate that.
Last edited by micseydel on Wed Apr 16, 2014 8:24 pm, edited 1 time in total.
Reason: Code tags, lock.
Nuber2Py
 
Posts: 1
Joined: Wed Apr 16, 2014 7:54 pm

Re: Push notification

Postby micseydel » Wed Apr 16, 2014 8:27 pm

It's just creating a format string for the struct.pack() call. The way he knew what the format string is should be documented somewhere by Apple.
Join the #python-forum IRC channel on irc.freenode.net!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
micseydel
 
Posts: 1358
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA


Return to General Coding Help

Who is online

Users browsing this forum: Baidu [Spider] and 2 guests