I have a method in an iOS project that calls avformat_open_input(), it runs very well in the simulator, however, when I try to run it on the device it hangs up and just stays there.
Has anyone seen this before?, Any help would be much appreciated.
That method establishes a connection to the source via URL, RTSP, RTP, etc, if it's hanging up:
Make sure that the source is in fact streaming data at that address and port
Make sure that you are connected to the right network if this is a local connection.
Please let me know how it works out.
Related
i need to Implement in my app Error report. i have already have this error report but the problem is that i use the grabURLInBackground to send the error and it's not a good Idea because i need to save those error's in array and ONLY when i have connection with the server i need to send all of those error's together. so my Question is how do i "listen" to a server connection?
how can i know when to send my error's ( Connection is Available ) ? do i need to do it in background? with what?
i hope you guy's Understood me :)
You will get a lot of example code code with Reachability. In fact you can google it.
I didn't found a solution which completely works for me as desired.
Here is a similar question, maybe.
And here is my test cases:
Connect your device to a WI-FI router, and unplug the WLAN from router, so has connection to WI-FI , but no connection to internet.
Case2:
Insert a SIM card, turn on the Allow data at setting via 3G, but the card has no 3G dataplan.
All of Reachability will say there is internet connection and all api calls are fake...
Despite working earlier, my socket chat app now refuses to write to socket on the iPhone!
It works fine on the simulator and again, used to run fine on my phone. I don't really know where to start troubleshooting this issue --- just seems weird. My server doesn't detect anything trying to connect.
Any ideas on how to start troubleshooting this?
Thanks tons.
I did run into a problem where using sockets on the iPhone would not open up the cell phone network unless something else opened it first. I had to run an http call to a generic web site first, and then the sockets would communicate normally. Try putting a call, like sendSynchronousRequest, to a generic web site, like www.apple.com, before opening your socket, and see if it works in that case.
I need to stop wasting all you nice peoples' time.
Long story, my friend updated to iOS 5.1. Now the 3G network reads 4G on iOS 5.1. So I turned off my (5.0) wifi to see if mine cell network was "4G" (which, of course, it wasn't).
But yeah, having turned off wifi my app could no longer join my locally hosted server...
I grabbed Charles though, and it looks handy, so thanks for that anyways. Also Owen's comment about the cell network originally made me think about checking my wifi, as my app shouldn't even be using the cell network yet. But I'll keep in mind what you said for the future.
Thanks everybody!
Whenever having to test my app which basically is some kind of communication via sockets with external devices, the device itself has to be available and connected.
I would like to ask,if there is a way to do the testing offline in some kind of simulation mode?
For instance, redirecting the socket communication to some kind of stored file. And the file itself is a log of a previous session with the real device stored in an appropriate structure. Of course one could only simulate a recorded session, but that would help a lot already.
thanks!
You should have a look at netcat. If you have a record of your "session" in a file, you can use nc to "play it back" on a socket with something like:
nc -l -p port_number < your_file
You can then connect to that port number with telnet and you'll see the session data coming in.
(You can do it the other way around too, i.e. have nc connect to your app and replay the session.)
Don't know iphone, but having a local client, (or server), app. as a simulator is very common on other platforms. It's especially useful if the peer app is under development as well - having a simulator often surfaces protocol bugs at both ends, (as well as in the simulator:).
Given an app spec that includes the protocol, but no peer yet, I usually start work on the simulator first - it gives me time to get experience with the protocol in an non-critical, non-deliverable way while the customer is still bolting on changes to the main app UI :)
Rgds,
Martin
I am trying to get a simple sockets program working on the Ipad.
To do this I am using the CFStreamCreatePairWithSocketToHost command.
It works fine on the simulator.
The problem is that it does not work on the iPad (I checked connectivity issues using the iPad's safari, and everything seems fine).
What I want to do is have the iPad open a connection to a PC. The reason I used CFStreamCreatePairWithSocketToHost was that I found a simple 10 line sample program which does this.
My questions:
1 - Does CFStreamCreatePairWithSocketToHost work on the iPad
2 - Can anyone direct me to a simple sample for ipad socket communications (I tried apple dev, and google. No sample that I found could be considered simple (less than 50 lines of code...))
Update:
Also tried sockets and NSHost, both withAddress and withName.
The results were the same: works perfectly inside the simulator, but does not work on the iPad.
I would suggest to use the socket-wrapper AsyncSocket. The download comes with a sample project.
edit
the most recent version can be found here
The low level APIs don't turn on the cellular radios. Use a very high level API to connect, then after the radios are turned on, disconnect if necessary, and (re)connect via BSD sockets.
An HTTP request to a server near the same destination IP would probably be sufficient.
Found the problem...
There was a "rouge" proxy problem in my organization, which was forwarding the saffari, but not my program (even thoughthe safati was not on an http port).
Solved, and thanks for your help.
Anyone have an idea on how I could check for a wifi connection where I don't necessarily need to connect to the internet? I've implemented wifi multiplayer in a game I'm working on, so I want to make sure and let the user know if there's no connection when they are trying to use that mode. The Reachability sample code seems to only work for situations where you have a host you are trying to route to. Since I have no knowledge of how other people's wifi will be set up, I need to be able to check for wifi without trying to route to a specific place.
Edit: Nevermind, I've got it. Just took a little more digging in the Reachability code.
You can check that you reach the access point (which will almost always be the iPhone's gateway, Internet or not). 802.11b/g/n with a route to the Internet and without a route to the Internet will appear exactly the same to the phone -- or any device, for that matter.
I could foresee asking the phone for its gateway and attempting to talk to it (ping, maybe?) but I'm unfamiliar with the Reachability approach. If indeed you have figured it out, I'd love to see an answer.
There is a method in the reachability class that returns an instance for wifi. I think it was called reachabilityForLocalWiFi.