How to get the best possible http connection in an blackberry application? I use the Network Diagnostic tool provided by RIM but most of the time it fails to find any connection while other applications are connected to the internet without a problem.
Is there any other way to find out how to connect to internet?
Try
http://www.versatilemonkey.com/HttpConnectionFactory.java
Hi I had created something to help myself out for the same purpose.. I hope it would be useful for you too.. Check it out at http://www.sameernafdey.com/2009/08/httpconnection-over-bis-wap-10-11-wap.html
Similar to #imMobile I have a library you can try as well here. It is very simple to use.
The HttpRequest should handle all the service book and coverage/transport stuff for you.
Related
I'am testing my iOS app, that use internet for getting data. Sometimes internet is unavailable, so I need a way to redirect remote connection to file on my local computer. I'am only need to test api. I have unit-tests with mocks,but they do not solve the problem completely.
I can setup server, and redirect connections to localhost, but I think there is a less complex and more accurate solution. Do you have any ideas?
Thank you.
are you trying to make a Unit Test for remote connection or for method that use a remote connection to get data ?
in case is a remote connection i don't know why you want to test it because for me it's an apple feature.
if because your method use a remote connection to get data, so i think that you have to broke this dependency by mocking the remote connection process and return something that you expect
So the best solution of my problem was to use framework for mocking network traffic: BarricadeKit (MMBarricade).
With this framework I can configure local server in iOS app. Framework will redirect all outgoing network traffic to this server.
I need to find the Wi-Fi's router address from my iOS app. I searched the web for a solution but nothing seems to do it. I need something that is not using private APIs an is not against Apple policies.
I have tried solutions found in the following articles and none of them actually give me the router IP address.
How can I determine the default gateway on iPhone?
Fetching IP address of router to which iPhone is connected
Objective-C : How to fetch the router address?
How to get the WIFI gateway address on the iPhone?
There also could be a way to "calculate" the IP from the mask and device IP (or maybe my TCP/IP course is waaaaay to far back in time)...
Thanks!
I have found a solution and tested it successfully. It was taken from this repo https://github.com/SiteView/GenieForiOS, I extracted only the code I needed for my getRouterIPAddress function.
Disclaimer: I'm not an Objective-C developer so the following code might have a ton of issues. Please feel free to correct me.
I have also made it into a Cordova plugin and included a demo project in the repo. It does what I need. I have also added an Android version, which is only 3 lines long. :)
https://github.com/vallieres/cordova-plugin-get-router-ip-address
What's the best way to make persistent HTTPS connections in Objective-C with Cocoa Framework for iPhone with NSURLSession? I've read somewhere else that persistent connections are standard since HTTP 1.1. Some code example would be very appreciated. I need to achieve a simple data retrieval task (json encoded string)
best regards
stefan
Follow this link http://www.objc.io/issue-5/from-nsurlconnection-to-nsurlsession.html to find out, what "no persistent" means to understand "persistent".
I haven't used NSURLConnection or NSURLSession myself, but persistent is not a special setting. It means, that the same settings-data is used for connection/session.
Nothing about NSURLSession...
But I've found a tutorial here
http://www.raywenderlich.com/51127/nsurlsession-tutorial.
I'm currently developing a server that can get data over the internet from specific device i have and log it into a database. Unfortunately I dont have control on the way this device communicate.
Currently I set an IP adress and a port number and the device will open a socket and send a string. I dont really want to develop a server from scratch and i would much prefer to base on a web server. but the data is a plain string and not a full http request.
Is there a way around it using Ruby on rails ? Is it possible to do with other web-server-based technology ?
Thanks a lot
You can use just a regular old ruby socket to receive the string.
Sounds like an application that node.js would be useful for, if you want a pre-made node+rails app which would do what you want check out compound at GitHub mentioned in this article
I am developing with lwuit to Nokia and Blackberry.
I am working with server and connections. If I call to server that I am working, all work fine. But, if I try to call to external url that receive jpg, the connection request is stuck and I get responde code 400.
The connection is failed in function performOperation() of class ConnectionRequest.
Why its happen?
If I call to my server and get image its work fine but when I call to external jpg it's don't work.
Is there any solution to this?
All this happen in simulator.
I don't really understand what you are looking for.
But I think you must check the URL of the image. Also, the class com.sun.lwuit.io.services.ImageDownloadService might be very useful to you.
RIM network connections differ from Nokia/standard J2ME due to all sorts of proprietary behaviors added by RIM. Codename One's IO API hides this complexity, if you don't want to migrate I suggest you read up on RIM's networking APN, its a bit complex for a single stack overflow answer.
Add ";deviceside=true" at the end of your url... like "http://myHost/images/flux.jpg;deviceside=true", for Blackberry
I found the problem. This occurs because i use POST method. I think in case that we dont send parametes but use method POST is occurs to problem with Content-Length in header of http message and this the reason that i recieve error(400 or 411)