iPhone/iPad as a server - ios

I want to create an app where clients connect to a server and communicate with each other via images and texts. I already have a server as backend, but is there any way that an iPhone becomes the server? I know that there is CocoaHTTPServer, but all of the examples are just a server displaying a webpage. Do you know how I can use it to fit my needs ?

There is no way to just take all you stuff that now runs on an apache directly to the iPone
You find a couple of tutorials and solutions in the internet.
Maybe this thread can help you: iOS devices as web server
Concerning CocoaHTTPServer
Maybe have a look at the SimpleFileUploadServer

Related

Using Node js in Multiplayer turn based game in ios

Hope u guys are doing great.
I want to make a realtime turn based game in iOS .
I know this can be achieved by using GAME CENTRE in iOS , but i have to play this between browser and iOS app. WEB TEAM is using node js for making this game on web browser , they also suggested me to use node js in iOS game as well.
Have anyone has idea how to use node js for this kind of purpose.
Thanking you all! :)
You can have websocket server written in node js and then just connect to it from your ios app using some websocket library (hope it exists). Then sockets connected from browser and your app can realtime exchange information.
You could use a pub/sub messaging service like Realtime (the company I work for) http://framework.realtime.co/messaging/
Both your node.js server and your ios devices could exchange data through Realtime pub/sub channels, using the node.js and ios SDKs.
The cool part is that since it's a managed service you don't need to worry about the server and networking administration, Realtime will take care of that for you.
I'd like to add some words in favor of #Edgar's answer.
For production, using only WebSocket is not reliable. In environment where WebSocket is not available due to antivirus, enterprise firewall, and so on, a kind of full duplex connection over HTTP should be available utilizing long polling or streaming in terms of reliable real-time connection.
Also such connection might be disconnected for a while e.g. moving away from Wi-Fi zone and then some messages which had to send through that connection may be lost so that a way to recover such messages is required e.g. here is some messages you couldn't receive.
Therefore, you need a reliable framework to write such real-time web application. Here's features which are required to write a real-time web application I think. (It's called Cettia and I'm the author of that project. As it doesn't provide iOS client, it's not right choice for you here. Just focus on features and roadmap to see what features you may be needed and evaluate a framework you will choose based on them.)
On Node.js world, socket.io framework has a great community so I'm sure someone already wrote iOS client for socket.io. Anyway, make sure that the framework you finally chose has features you need to write your real-time webapp.

Elasticsearch client for iOS

Does anyone know of an elasticsearch client library for iOS? Would be a bonus if it was written in swift as well.
The elastic search 'clients' section shows multiple libraries for a number of platforms but nothing for iOS, I feel like someone must have done this?
Cheers
I doubt that anyone has - last time I checked there were none and for good reasons. Keep in mind that in order to allow an IOS client (or Android for that matter) to use a client library to connect to Elasticsearch you'd have to open up your cluster for either an http or node access - which would allow anyone to do anything to your cluster.
Maybe you could proxy it to prevent deletions and insertions but even so it would open up your cluster's data and open you up to DoS attacks.
Generally a better idea is to create your own REST API that incorporates some type of authentication and authorization and does not open up your cluster to the world.
If you still feel strongly about moving forward you can always just hit the http interface of the REST API for ES. Or take a look at this project someone was working on a few years ago at least to give you a head start:
https://github.com/tallpsmith/ElasticSearchIOSHead
Some recent discussions on this topic:
http://elasticsearch-users.115913.n3.nabble.com/Objective-C-client-for-ElasticSearch-iphone-ipad-etc-td3911216.html
Running Elasticsearch server on a mobile device (android / iphone / ios)
This may be what you're looking for. ElasticSwift. Seems to be in active development but haven't looked deep into how far they've gone.
This is another iOS Swift client that was made back in 2018: Appbase-Swift. It's a lightweight ElasticSearch/appbase.io client. Doesn't seem like it's been updated in awhile though.
We tried a lot for elastic and finally concluded that it on most of the challenging side. another thing is a bit bulky to use on mobile, as per my understanding no room for the optimization. We can only use HTTP Web Service call for the same service. Also, the flavor of the offline search can not be implemented in the mobile elastic till date...

Network Debugging iOS Application

Is there a library or plugin out there that will allow me to capture all network requests made by my iOS application (in DEBUG mode only of course) and store the requests in a file?
I am aware of Pony Debugger, but it only let's you view the network requests in Chrome Developer Tools Dashboard. I want an actual file I can process at a later time.
I find myself using Charles http://www.charlesproxy.com/ fairly often. You can use it to proxy in the simulator or you can set turn the proxy on and then proxy your iOS device over it. It's also nice to simulate network problems like latency and slower speeds (you can use network link conditioner as well but it's a pain to keep going back to the settings app). They have a free trial so you can decide if it's right for you.
If your using AFNetworking there is a library, AFHTTPRequestOperationLogger that will allow you to easily print all requests and responses to the console. I know it's not a file but with a little work you could pull the logs off your device for later inspection.
Lastly if those options don't suite your fancy you can roll your own solution with NSURLProtocol. It probably wouldn't be much work and there is a ton of information out there on it. NSHipster did a writeup a couple of years ago http://nshipster.com/nsurlprotocol/.

How can I send a file from an iPhone to my server?

I've seen lots of questions and answers about this topic, but unfortunately none of them seem to fit my needs closely enough. This question is about both iOS and vb2010.
I have created an app which communicates with my server (at this point, "my server" is actually my Win7 machine that I am using for development. Eventually it will move to an actual server). The back end is a VB program that interfaces between the iPhone app and a SQL Server database. A specific port is open to the computer, and everything there works great. I am able to retrieve data from the database and display it on the iPhone with the app, and also able to save records from the app to the database. It's all so very cool, and I'm really jazzed about it.
The final phase of the project requires uploading a camera image to the server. This is the part where it gets funky for me.
So far I have been able to save the image as a file on the iPhone's disk. Now I need to understand better how to transfer that file to a directory on the server.
I know that there are many techniques that use the "post" method, but as I understand it, that requires a PHP or ASP page to accomplish. FTP generally uses ports 20 and 21. What I would really like is to be able to set up the existing software to receive an upload request from the app, and then place itself in receive mode. This would not require opening another port, and I can tailor the VB code to handle the file however I like.
All I really need to understand is, how can I get the two programs to do the file transfer? And is it reasonable to assume that I can use the same port?

Android wifi connection

Hie members! ----am Boniface M - - a beginner in android[University student]..
My question is am planning to develop an android app/middleware that will act as a grid service .i.e an app for grid computing.. the application needs to be installed in 1....n devices. in the connection, one device must act as a server for all others. communication between the devices is via the wifi under the permission of the server device.which is determined by a certain algorithm[no problem here].
The problem is should i use a database that will keep track of all the services a device is running which are accessible to other devices or is there any way that i can directly keep all this information and then retrieve them as i request them from another app installed in another device.
and also how i can share files via wifi like blutooth
Thanks....
You're asking many questions in one and I'm actually unsure what you mean overall. Here's a few links that are sure be of some use...
http://developer.android.com/reference/android/os/Build.html This library is good for finding out information about the device you're running on.
http://developer.android.com/reference/android/location/Criteria.html - Criteria might be useful, lets you know what location based services you have running
Other than that, if you're looking to see if particular things are running check out this question: How to check if a service is running on Android?
If you're looking to keep a central hub of what devices have what available etc. you're going to need a middle man for what you want to do I suspect. If it was me, I'd do HTTP requests to a server, to php scripts I have written which would then read/write from a MySQL database to get information about other devices.
If you want to share files via wifi.. you're going to need an FTP server on the phone. There's an app swiFTP which does this to some degree (phone -> PC) but the concept should be the same. Take a look at it. It's a starting point! http://www.tested.com/news/how-to-transfer-files-wirelessly-to-your-android-phone/53/
Again, I'm unsure EXACTLY what you're looking to do but hopefully all of that is of some help. If it's not leave me a comment and I'll try and assist you further.
hope it helps!

Resources