c equivalent of php apns code

CamperBoy

New Member
I am writing a .c apns (apple push notification server) application,
I have the rest of the program working ie connecting to the servers establishing ssl, json encoding the message etc.
However I am stuck on the part that converts the token to a hex string part.
Example values
$deviceToken is "4DBCD414F624842E581972E65D2DAA4B96279B209BD0CE10AB12E52AEA48A670"
$apnsMessage is "{"aps":{"alert":"testing","badge":1,"sound":"elephant.aiff"}}" Here is a php snippet which does the job at the moment. \[code\]$apnsMessage = chr(0) . chr(0) . chr(32) . pack('H*', str_replace(' ', '', $deviceToken)) . chr(0) . chr(strlen($message)) . $message;fwrite($this->apnsConnection, $apnsMessage);\[/code\]Any help would be appreciated.ThanksPeter
 
Back
Top