I'm trying to get the apns daemon at http://code.google.com/p/apnsd/ working, and am having problems with networking. I've configured the daemon to listen on port 1055 (but I've also tried other ports). I can start the daemon and it seems to work ok (including connecting to the apple servers), but I can't see the network port being open and listening when I type netstat -a. I am running on Windows 7, and have turned off Windows firewall (so I don't think it's a firewall problem).
I've successfully run the twisted demo server and client at http://twistedmatrix.com/documents/current/core/examples/index.html (simpleclient.py & simpleserv.py) on a variety of ports, and can also confirm that the ports appear in netstat -a, so I don't think that the problem is in installation/configuration of OS/python/twisted/other required modules.
I believe the relevant code (print statements added by myself) in the dameon is:
print "LISTENING TCP SERVER"
print "PORT", listener_data["port"], listener_data["port"].__repr__
server = internet.TCPServer(listener_data["port"], listener)
print server
I would have thought that after executing this line the port will appear is open in netstat -a. Can anyone suggest what the problem is, or provide suggestions as to how to diagnose further?
I don't think it's relevant, but my apns daemon configuration is:
{
'listeners': {
'line': {
'class': 'apnsd.listeners.line.LineProtocolFactory',
# 'interface': "192.168.1.3", #default: all interface
'port':1055,
},
},
'apps': {
'gp': {
'apns_dev': {
'app_id': "xxx",
'app_class': "xxx",
'certificate_file': "F:/cert_file.pem",
'privatekey_file': "F:/pk_unencrypted.pem",
},
},
}
}
Try starting the daemon using twistd instead of with main.py.
The twistd script is Twisted's utility to turn a twisted app into a service. The usage is:
$PYTHON_ROOT/bin/twistd apnsd -c $APNSD_CONFIG
This would start apnsd as a daemon. To not daemonize it, simply pass in the -n parameter:
$PYTHON_ROOT/bin/twistd -n apnsd -c $APNSD_CONFIG