Question:
Is it possible use socket to connect to apple apns and to encode binary data as indicated here ?
Yes, the Chilkat Socket API can certainly do it. Your application, however, must do the work of composing the binary message according to the specifications at https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW1
Once your app has composed the valid binary message, sending it is no different than sending binary data on any TCP connection (with or without SSL/TLS).