roycezhc / javapns

Automatically exported from code.google.com/p/javapns
0 stars 0 forks source link

I can connect to push.apple.com but i can't receive data. #145

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
code like this:

Push.alert("Hello World!",Config.CERT_PATH,Config.CERT_PASSWORD, 
Config.PRODUCTION, deviceToken);

log detail:

0    DEBUG [2012-09-21 11:10:28]  Adding alert [Hello World!]
987  DEBUG [2012-09-21 11:10:29]  Creating SSLSocketFactory
1091 DEBUG [2012-09-21 11:10:29]  Creating SSLSocket to 
gateway.sandbox.push.apple.com:2195
1980 DEBUG [2012-09-21 11:10:30]  Initialized Connection to Host: 
[gateway.sandbox.push.apple.com] Port: [2195]: 
689e8c34[SSL_NULL_WITH_NULL_NULL: 
Socket[addr=gateway.sandbox.push.apple.com/17.172.233.66,port=2195,localport=608
76]]
1988 DEBUG [2012-09-21 11:10:30]  Building Raw message from deviceToken and 
payload
1989 DEBUG [2012-09-21 11:10:30]  Built raw message ID 1 of total length 77
1990 DEBUG [2012-09-21 11:10:30]  Attempting to send notification: 
{"aps":{"alert":"Hello World!"}}
1990 DEBUG [2012-09-21 11:10:30]    to device: 
8a87e5c638ec7983a489343638441da71d361b9c76b4104ce7ae044b92fd63c3
32023 INFO  [2012-09-21 11:11:00]  Attempt failed (Read timed out)... trying 
again
32024 DEBUG [2012-09-21 11:11:00]  Creating SSLSocket to 
gateway.sandbox.push.apple.com:2195
32939 DEBUG [2012-09-21 11:11:01]  Attempting to send notification: 
{"aps":{"alert":"Hello World!"}}
32939 DEBUG [2012-09-21 11:11:01]    to device: 
8a87e5c638ec7983a489343638441da71d361b9c76b4104ce7ae044b92fd63c3
62967 INFO  [2012-09-21 11:11:31]  Attempt failed (Read timed out)... trying 
again
62967 DEBUG [2012-09-21 11:11:31]  Creating SSLSocket to 
gateway.sandbox.push.apple.com:2195
63815 DEBUG [2012-09-21 11:11:32]  Attempting to send notification: 
{"aps":{"alert":"Hello World!"}}
63815 DEBUG [2012-09-21 11:11:32]    to device: 
8a87e5c638ec7983a489343638441da71d361b9c76b4104ce7ae044b92fd63c3
93843 ERROR [2012-09-21 11:12:02]  Attempt to send Notification failed and 
beyond the maximum number of attempts permitted
93844 ERROR [2012-09-21 11:12:02]  Delivery error
java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:146)
        at sun.security.ssl.InputRecord.readFully(InputRecord.java:312)
        at sun.security.ssl.InputRecord.read(InputRecord.java:350)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:850)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1190)
        at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:657)
        at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:108)
        at java.io.OutputStream.write(OutputStream.java:75)
        at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:402)
        at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:350)
        at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:320)
        at javapns.Push.sendPayload(Push.java:177)
        at javapns.Push.alert(Push.java:47)
        at org.daren.apns.servlet.RegisterServlet.doPost(RegisterServlet.java:49)
        at org.daren.apns.servlet.RegisterServlet.doGet(RegisterServlet.java:37)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:679)
93845 ERROR [2012-09-21 11:12:02]  Delivery error: 
java.net.SocketTimeoutException: Read timed out
93846 DEBUG [2012-09-21 11:12:02]  Reading responses
98851 DEBUG [2012-09-21 11:12:07]  Closing connection

does anyone know the reason?

Original issue reported on code.google.com by hanxu...@gmail.com on 21 Sep 2012 at 3:16

GoogleCodeExporter commented 9 years ago
An interfering proxy or firewall is most likely the issue...  have you checked 
those?

Original comment by sype...@gmail.com on 22 Sep 2012 at 1:15

GoogleCodeExporter commented 9 years ago
Maybe the reason is about firewall, but the firewall is not in my control.
And i know, all the port range 1024~65535 is open, but  i still cannot
receive data....

I ran the same code at the instance on Amazon,it goes well.

thank you very much and i will change the environment.

Original comment by hanxu...@gmail.com on 22 Sep 2012 at 1:41

GoogleCodeExporter commented 9 years ago
Have you solved your issue?

Original comment by sype...@gmail.com on 28 Sep 2012 at 5:39

GoogleCodeExporter commented 9 years ago
Closing for lack of feedback for a month, and because this was likely a 
firewall issue.

Original comment by sype...@gmail.com on 25 Oct 2012 at 2:51