I am trying to implement iOS push notifications in my app using the code posted on this forum. I can’t seem to get the SSLSocket to connect to the apns - I keep getting error code 301. Does anyone know how I can track down is error code?
301 is the error code for “moved permanently”, so you probably check the address.
Navigate through the HTTPSocket.PageHeaders.Name till you find the name “Location”. Then simply get the new location with HTTPSocket.PageHeaders.Value
Thanks for responding. This error code doesn’t make any sense then because I am connect to Apple’s apns server. For what its worth here is my code, if anyone has any ides I would really appreciate it…meanwhile I will go back to pulling my hair out.
[code] Dim mySocket As SSLSocket
Dim f As FolderItem = GetFolderItem("").child(“Pushcertificateandkey.pem”)
Dim g As FolderItem = GetFolderItem("").child(“reject.txt”)
Dim counting As Integer
mySocket=new SSLSocket
mySocket.CertificateFile=f
mySocket.CertificatePassword="****"
mySocket.CertificateRejectionFile=g
mySocket.ConnectionType=mySocket.TLSv1
mySocket.Secure=true
mySocket.Address=“gateway.sandbox.push.apple.com”
mySocket.Port=2195
mySocket.connect
Dim t As String
Dim x As Integer
While mySocket.IsConnected = False
mySocket.Poll
x=x+1
t=str(x)+": "+str(mySocket.LastErrorCode)
Listbox1.AddRow(t)
ListBox1.Refresh
Wend
if mySocket.IsConnected Then
Dim packet As String
packet = packNotification(0," ", " ")
counting=counting+1
mySocket.Write(packet)
mySocket.Poll
MsgBox(str(mySocket.LastErrorCode))
end if
[/code]