Blackberry application to establish an http connection - blackberry

i have been working on developing an blackberry application. as per now i want the application to connect to a local server on my network and fetch a file from that machine. i have been using the library given by a named blackberry developer Mr.peter strange....here is the link for the same Http connection through BIS-B
my requirement would be setting up connection to the local server using any transport mode but it should be able to render the text downloaded.
i tried using the demos provided by blackberry samples as it comes with the plugin for eclipse the http demo from those samples shows only trying to setup an http connection string and the networkapidemo sample shows diffrent http codes when the url is entered as desired.i am running all the applications on the simulator. i havent tried running any of my apps on the hardware
may i know why this problem arises of http codes....ill also want to know guidelines about how to set a simple http connection just to download a file(text file) from a local server.
I have tried many forums too. if anybody would have a look at it i would post it here.
Only a simple connection is becoming a headache!
anyways...waiting for replies..
thanx in advance guys :)

It does not matter whether you want to communicate with local or remote server.
1) See the API docs on HttpConnection. There are sample code in there.
2) Unfortunatelly, on BB you should be aware of Network Transports. Check this thread to get all info you need on Network Transports.
UPDATE:
The second point explains an approach that will work on any OS. If you need an OS 5+ only approach, then check the ConnectionFactory API. ConnectionFactory usage sapmles.

Related

How to load Ruby-on-Rails webpage to Samsung Gear S2

Good Morning. I've been searching thoroughly and can't seem to find a similar question. The Tizen documentation seems to not be straightforward.
Suppose I have a Ruby-on-Rails application running on localhost, say at 192.168.1.3:3000. How do I create a Tizen application on a Samsung Gear S2 device that would connect to the running server and fetch the webpage from there? Is this possible?
you can use XMLHttpRequest.
For XMLHttpRequest tutorial you can see:
How to get the response of XMLHttpRequest?
http://www.w3schools.com/json/json_http.asp
*Don't forget to add the required privileges.
*Also remember to connect your GS2 to the same router your localhost is connected to.

inspect http requests in ios simulator/devices

I am working on an ios app which communicate with the server via http request. And I want to monitor the network traffic when testing my app in ios simulator/devices.
Is there any software or tools I can used to inspect the http requests of a specified application on mac/ios, just like firebugs for web developers?
Thanks.
As far as I know, there are several tools in App Store that provide the network traffic monitor feature. But, they could only view iPhone as a whole and stay at that level. In other words, they could only tell how much traffic has been consumed of this iPhone. For each app? No data.
You can use HTTP Catcher to capture web traffic. It's a Web debugging proxy for iOS, so you can view requests and responses directly on iPhone.
You can use Proxyman to record/capture all the requests & responses from your app while developing.It will support ios simulators also. Without doing any code change we use this.
First Download the Proxyman app form the above link after that just go through this documentation for references.
Charles has recently released an iOS version for http traffic monitoring. it is a paid app though. Good news is that you can set up Charles free desktop version then setup HTTP proxy from your iOS device.

iOS: filesharing without iTunes?

I develop an enterprise application for iOS and the user should be able to add files from the desktop to the application.
I implemented this using filesharing, which works great.
Now this company wants to get rid of iTunes from their machines (which is quite understandable, iTunes is a very invasive process).
The question is, is it still possible to somehow use filesharing without iTunes? maybe with another application?
Or what other way is there to send files to the app (preferrably without the need of an internet connection)
//edit: must work on windows 7 and must not require to install iTunes (there are some other tools that allow access to the iPad filesystem, but they go through drivers installed by iTunes)
You could exchange data via the local wireless network (a connection to the internet is not required, just the iOS device and the Windows computer need to be on the same network).
One option:
You can then create a simple TCP/IP connection over sockets between an iOS app and a Windows application and exchange the data you want.
However you probably need to implement a suitable simple Windows application to do this.
An other, maybe simpler, solution:
You could start a webserver in your iOS-App and show it's IP on the screen. By entering this IP in a browser on the desktop computer you can access websites on the iOS device, which can make documents available for download or receive uploads.
For how to do this, have a look at this question.
There are a number of ways to achieve this, ranging from trivial to sophisticated.
Your question says that you would prefer to avoid an internet connection. Simple solutions may require it - if you want to abstract the difficult parts, you're going to have to let somebody do the dirty work, and that's probably going to be someone(thing) on the internet. Midrange solutions may require a network but not internet connection. A sophisticated solution could probably be whatever you want - but one thing I would say, is that trying to tap into the USB connector is either going to result in a hacktastic or very complicated solution to implement.
One method would be to integrate a third party framework that basically does what your looking for. Look at the Dropbox development kit, for example - allowing Windows (or any platform) users to drop files on their desktops into a shared dropbox, and this can then be read by an iOS application which includes the iOS drobox API.
Another method would be to setup a simple WebDAV server in your office. Host it on a windows box, or a cheap linux box. Give users desktop's access to the share via whatever protocol you want (eg, Windows File Sharing). Then you'd implement a WebDAV client in your app (eg, WTClient) to pull files.
Finally, you could build your own transmission system. A sophisticated example might involve Bonjour and TCP/IP, a simpler-but-custom solution may involve a simple JSON web service running off a local (or remote) server.
I have suggestion but that will require the Internet. I would suggest you to use the DropBox API in the windows and iPhone both. It's awesome to use and very simple for file sharing.
Now a days everybody have dropbox account and have files in it to share. So that shouldn't cost anything other than a bit of implementation (this learning can also be used in other file sharing applications).
Here are some guidance:
iOS
REST API
You can add apps and documents to USB-connected devices with the Apple Configurator
You may use a simple Ftp server installed on PC, so you can connect to server from Ios and upload/download files from iOS to PC....
http://developer.apple.com/library/ios/#documentation/Networking/Conceptual/CFNetwork/CFFTPTasks/CFFTPTasks.html
All work is done by Pc and your app will use IP (Intranet or Internet) of PC to share all files.
From Ios you can read all files in FTP server and work with them.
I use the FileBrowser app to get access to network shares over WiFi and will allow you to load supported files to the device. The company responsible is creating an API to allow you to do this within your own app: https://twitter.com/#!/Stratospherix/status/193114857271336960

APN Settings for O2 service in UK + Blackberry

I am developing an application which requires connection to the internet. Till now i have been using Wifi and WAP 2 connection UID for Http connection and everything has been working fine. But now the client is telling that he wishes to use direct TCP connection as using WAP2.0 connection costs him a big amount.
I am not having clear understanding about APN settings. I have goggled a bit and appended 'deviceside=true' to the url and then set the APN in the Settings->Advanced Options->TCP/IP. But everytime I run the application, I am getting 'Timed Out' Exception.
My client is using O2 carrier. I googled and found out that APN for 2 are 'mobile.o2.co.uk' and 'wap.o2.co.uk' but using these two also client is not able to make Http connection. Is there any way of free unlimited internet connectivity in third party applications?
I am not having a clear understanding of APN settings so kindly bear with me. I am using OS 4.5
Eargerly waiting for reply.
Welcome to the confusing world of network transports on BlackBerry! You will want to start with the article Connecting your BlackBerry - http and socket connections to the world.

how to implement a server on iPhone

Assuming I have implement that :
making my app as a server which means in safari I can connect to the app if I input http://url-link.
My question is : if I request http:// url-link/doc, and the server - that is my app can return the content in document directory.
I don't know how to write the web service in iPhone.
As I'm fresh to web service, can any one help me?
thanks
This is one possibility: Cocoa HTTP Server. From the project's page:
So with Apple's framework for an HTTP
server tucked under our arm we set out
to make our own. We wanted the
following:
Built in support for bonjour broadcasting
IPv4 and IPv6 support
Asynchronous networking using standard Cocoa sockets/streams
Digest access authentication
TLS encryption support
Extremely FAST and memory efficient
Heavily commented code
Very easily extensible
You can link this library from your app and effectively make it a mini-web server.

Resources