Can anyone tell me why i am getting this IOException:smileytongue:eer refused the connection??? I was testing my application yesterday it was working fine..but today when i opened it i cannot log int my application...i cannot login from the simulator.
.i hve tried appending ";deviceside=true" , ";deviceside=false" and removing it from the url..but nothing seems to work even on simulator...Iwas able to login until yesterday...no change in the code has been made...
The login url is Https url..but i dont think that may be the issue since i was able to access it till yesterdey...
Can any one help..??
I'd double check that the server you are talking to is still up (can you connect to it from a browser on your computer?) and also ensure that the Windows Firewall is not blocking traffic from the simulator. Also, unless you're just using Direct TCP and/or Wi-Fi, make sure that MDS simulator is up and running BEFORE you launch the simulator.
Related
I have an issue with a single (at least for now) iPhone not being able to connect to websockets. Unfortunately I don't have access to the device and I can't run more tests on it at the moment, so no proper network dumps or anything else deeper level debugging available. Can't test on other network connections either at the moment.
Everything works perfectly with Chrome 45, Firefox 40, Chrome 45 on Android (many devices), Safari on iOS9 (device A), Safari on iOS8 (device B) etc. No errors, no cutoffs, nothing. Just works.
My websocket server runs on IIS 8.5 / ASP.NET, created as an API controller with the typical way (PullHandler is an async Task whileing until connection closes)
if (HttpContext.Current.IsWebSocketRequest)
{
HttpContext.Current.AcceptWebSocketRequest(PullHandler);
return Request.CreateResponse(HttpStatusCode.SwitchingProtocols);
}
else
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Bad request");
This should not cause any issues, especially this one. The client side JavaScript is also the simple
new WebSocket("ws://" + window.location.host + "/api/Some/Endpoint);
I am using plain HTTP, no SSL/TLS.
When trying on iPhone device X with iOS9 (13A344, not entirely sure of which model) it just can't get the connection. I am also using SignalR which automatically goes into longPolling transport on this device. With others it's nicely on webSockets transport.
Quick testing on UK Orange 3G connection showed on my HTTP logs that for some reason the request for my endpoint has gone to the else branch, like something had stripped the upgrade headers away.
GET /api/Some/Endpoint 80 - Mozilla/5.0+(iPhone;+CPU+iPhone+OS+9_0+like+Mac+OS+X)+AppleWebKit/601.1.46+(KHTML,+like+Gecko)+Version/9.0+Mobile/13A344+Safari/601.1 - 400
Status 400 is clearly showing the bad request that my code is sending if the request is not a proper websocket request. I don't know if there could be some transparent proxy, that could explain this. The 400 response was received without any delays.
But this was a problem also through wifi on the same device. Again, a laptop with OS X and Safari had no issues on the same wifi to connect to SignalR and my websocket server. Only the iPhone had issues. On wifi I didn't get any attempts to connect on the logs and SignalR also immediately went into longPolling transport. The wifi apparently used Virgin Media's network based on IP address.
On wifi there is first an open event. Then after some time there is a close event with status 1006, which is abnormal termination without a close packet. My code tries to connect again and the same happens. Strangely there is no log entry at the web server, but it might just be Safari's way to post the open event even though an actual connection was not established and after a timeout it sends the close event.
The device should not have any proxies set up and other browsing works without issues. Unfortunately I couldn't get any information about any other site that would use websockets working or not on that device.
Has anyone run into this kind of situation? I do understand that the 3G might just be a misbehaving proxy, but the wifi issue cannot be explained with that.
Just want to expand the universe for this issue.
I Have an app that runs great in simulator. App has both http Jason IO and web socket IO.
Now that I can target my iPhone and not the simulator. App on iPhone successfully does the http Json stuff but not the web socket stuff.
While I am not using safari and js my symptoms are very similar to yours. I am using Xcode 7 to generate code that targets to iPhone 5 using iOS 9.0.
To sign in and access various functions of our iOS app, the user needs to be connected to our VPN network from their iOS devices. The webservices that the app calls are also only accessible over VPN. In order to determine if the user is running the app over VPN (online mode) or if the user is running the app outside of VPN (offline), we are using Apple's SimplePing class helper https://github.com/chrishulbert/SimplePingHelper. We pass the host name of our web services to make the ping call. If it succeeds, we conclude user is on VPN. If the ping fails, we conclude the user is not on VPN and give him a message saying he needs to connect to VPN.
The issue we are seeing is that sometimes we get a ping failure even if the user is on VPN and this results in the user getting a message that he lacks connectivity. If the user tries some action again, the call succeeds.
We are not sure of what causes the pings to fail intermittently and succeed again when tried in a few seconds. Has anyone experienced this kind of an issue? What could be the possible cause and resolution? Any ideas are welcome.
We use SimplePing and I noticed that sometimes it fails to resolve the hostname (in -(void)hostResolutionDone) even before it gets to the actual ping. I haven't yet figured out why but my workaround was to stop/restart the ping service. The host resolution failure happens infrequently so it usually corrects itself the second go around.
I used GCDAsyncUdpSocket to send udp message to discover ssdp service, in iOS reported "No route to host" this error,but there is no problem in the simulator above can be found in service, is that how it happened? I searched a lot of information, but no discovery could help me.
I've run into the same thing. Of course without your source code we can't help you other than to provide vague guesses. I hope you've fixed it by now and if you recall what the problem actually was, please let us know.
Things to check :
Firewall settings on the host. I was trying to receive messages on my mac book and found that Firewall settings can block the port you chose. Firewall is under system preferences on the 3rd tab.
Use apples Reachability class to make sure you've got an active WIFI/Cell connection to the internet. (here : https://developer.apple.com/library/ios/samplecode/Reachability/Listings/Reachability_Reachability_h.html#//apple_ref/doc/uid/DTS40007324-Reachability_Reachability_h-DontLinkElementID_7 )
You can also use other functions in the Reachability class to let you know if the host is reachable before even bothering to open up a socket.
If the host is your mac and the simulator is on the mac, there isn't much of actual network traffic and then when you run on your phone you are actually using real networking. Be aware of, depending on your networking situation, you may need the external IP address of your host (vs the internal network WIFI address e.g. 192.168.1.4 )
Some people have reported a bug where UDP stops working and you get no route to host messages but for some reason turning on and off airplane mode fixes it. Maybe check out their solution (using keep alive messages ever 30 seconds or so to prevent power management from turning off the cell connection). Here is an example : intermittent "No Route to Host" on iOS, flight mode off then on fixes
In case you are developing an App Clip for iOS app, be aware that:
a) Background Session is not supported
b) Multipath is not supported. Setting `multipathServiceType = .handover` on `URLSessionConfiguration` will cause all requests failure due to `No route to host`
Calling
Connector.open("http://MySpecifiedURL.com;deviceside=true;apn=rim.net.gprs");
Throws IOException: "peer refused the connection".
This happens only with few specifies URLs, that used for web services and only on BlackBerry OS 6, on other OS versions (5.0 and 4.*) and with other URLs everything works correctly. Can somebody help me with understanding why this happens?
A "peer refused the connection" error occurs when the server doesn't like something about the connection, i.e. you didn't supply the right userid/password to the APN, or there's nothing listening at that port. My first try would be to drop the apn= part of the connection string.
But if I were you, I would switch to using Versatile Monkey's networking helper class which will find the best TCP connection path for the device, regardless of OS version. It will let you handle the cases where devices are paired with a BES or not, if Wi-Fi is available, etc. It's really easy to use and solves a lot of connectivity problems that BB developers face given the mix of devices out there with BES, BIS, Wi-Fi, etc.
The definitive answer to this subject I found it in "Apress Begining Blackberry Development Nov.2009".
From page 186 to 190 more or less... they throw out a perfectly written code for this... you invoke this Method they define and it will return the extra parameters needed to make a proper request depending on the network availability.
I cannot paste the code here since that would be illegal.
Cheers!.
I have a MIDlet that sends TCP messages over the network to a server residing on the same internal network.
Whenever I try to connect using this line:
StreamConnection writeSock = (StreamConnection) Connector.open("socket://" + serverIp + ":" + serverPort, Connector.READ_WRITE);
I get an error saying
Tunnel Failed
According to netstat, the port on which the server is set to listen is actually open and in listening mode. I printed the IP and Port values from the mobile application and they seem to be correct.
I have looked on the internet and many people solved the problem by setting up their APN details. I did such a thing, and the problem still persists. I have no clue what I have to do next. Just for checking purposes, these are the APN details I entered:
APN: internet
Username for APN: internet
Password for APN: internet
My carrier is Vodafone Malta. Just as a side note, this part of the application works on an emulator. I am using a default emulator (DefaultFxPhone1) that comes with the j2me package, and I am using Netbeans 6.8.
I have tried enabling and disabling the firewall, but to no avail.
Thanks in advance.
You may also want to consider trying adding the ";deviceside=true" parameter to the end of the connection string. The default is false, which implies MDS (BES infrastructure). To do direct TCP over the APN, you need to set it to true.
"Tunnel failed" means that your APN is not configured properly in the device. You may need to do some Googling to find the proper APN for your carrier.