How can I find the IP of a network service from the iPhone - iphone

I want to use some sort of nmap-like functionality to autodiscover a ASP.NET web server (running on port 443) somewhere on the network. This way users don't have to find and enter the IP manually. Is there a good/clean way to do this?

Thanks to #ceejaoz's comment above, I was able to do this pretty easily in Bonjour.
I used Mono.Zeroconf, a .NET/Mono Bonjour library, to advertise the service, and the default iOS NSNetService stuff to resolve it on the iPhone. (There's plenty of tutorials on how to do this around the nets).
I made a Windows Service in Visual Studio to actually run the code that advertises the ip and port, since a web service isn't really a good place for that.
One big caveat (as of December 2010): the Bonjour DLLs that come with Mono.Zeroconf are totally broken (no errors, they just don't do anything). Steal the ones from Pidgin instead.

Related

How can you use Fiddler (or equivalent) with the emulator in the Windows Phone 8 SDK when on a domain/network that uses IPSEC?

Now that the WP8 Emulator is based on Hyper-V, the old method of using Fiddler to intercept network traffic doesn't work if the network uses IPSEC.
Is there a way to use Fiddler and a WP8 emulator in such a scenario?
Fiddler with exactly the same setup as on WP7 (https://fiddler2.com/fiddler/help/phone.asp) works absolutely fine for me.
You grab the traffic from the host system, so the guest (the WP8 emulator) has to bypass that too.
If it doesn't work let me know, but for me and others I know, it runs without any issues.
I finally found the answer at http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj684580(v=vs.105).aspx
On a corporate domain, the emulator appears as a separate network device that is not joined to the domain. As a result, you may also
have to get an exception from your IT department before the emulator
can connect to services that are running on the domain-joined
development computer.
A network security exception was required.
You will probably have to use something like wireshark which works at a sub-protocol level and can therefore intercept anything.
Note that analysis won't be nearly as easy as it is in Fiddler though. Also, HTTPS connections might be impossible to analyze because of the whole man-in-the-middle attack prevention brought on by the protocol and certificates and such.

How to connect and read/write file to a local computer on iphone?

i have a problem with local network connection. i'm writing an iphone application and i need to read/write files to a computer. Both devices connected on the same network.
if it's possible, i want to get connected computers ip list, select one of them and read/write files like pdf, doc, txt etc.. if it's not possible to do, i will write the computer ip which i want to connect. There is no problem, both of solution is OK.
But i dont know what do i do after get the computer's ip ?
i found this chat client/server on local, but i got it very complicated.
Anyone have any idea about this ?
You'll need to have a server running on the computer, which can show files and allow for files to be read and created.
Easiest is to run a webdav service on the computer, Apache provides the mod_dav module for this purpose.
The iPhone app then becomes the client. I'd suggest using neon for this purpose. It's a C library that provides listing, reading and writing files on a remote webdav server.
That's how I would do it.
1) Find the network address of the computer you want to connect to. For this you can make use of Bonjour. It's very easy to setup because Bonjour handles the resolving of address for you.
You just have to publish a service (e.g. _myprotocol._tcp) via the ´NSNetService` class which is available on iOS and OS X (Windows too)- in your case you would publish the service on your computer.
Then you search for the service with the NSNetServiceBrowser class.
When you found a service you can then resolve it. This actually gives you the network name of the other device.
2) Connect to the other device via a tcp socket. The CocoaAsyncSocket library is very good at this. This project also includes some examples. One example already provides a bonjour server and client implementation.
i found exactly what i want. The solution is here

Debugging network connections on the iPad. Any tools or techniques?

I'm trying to get my iPad (3rd gen) to access a website on my workstation over an https connection (though I should perhaps mention I cannot connect to it over HTTP either). The aim is to have a working demo of two-way authentication with certificates.
I've installed the client cert on the iPad and a number of Windows and OSX machines on our network. But the iPad seems to be having trouble getting the IP from the local DNS server or perhaps hitting the DNS server at all. As there doesn't seem to be a Hosts file or any way of debugging the network side of the iPad I'm a bit stuck.
Does anyone have any hints/tips/tools that could make my life half-way bearable?
Unfortunately things like you mention aren't built in in iOS. I would have a look in the App Store and get an app to perform pings and do DNS lookups. Maybe NetTools could work for you?

Connect to attached pc from WP7 by opening a socket to localhost

When developing and testing WP7 apps you're pc is connected to either a real WP7 phone or to the WP7 Device Emulator. For a specific development-purpose I would like to connect directly to the development pc (let's call it the host pc) from the WP7 app without having to rely on an external toast-server. I'm using plain sockets, System.Net.Sockets.Socket.
There seem to be two options:
Obtain the host pc's LAN IP and connect to that
Connect to localhost
Option 1 usually works well, but not always: The host pc may not necessaily have an IP, in which case there's nothing to connect to. Also, in some scenarios all LAN traffic is directed through a company-wide proxy which will disrupt this mechanism.
That lead me to try out option 2. To my surprise it seems to work, but I need to be more sure than simply "it seems to work". I've googled all over but can't find any definitive answer, not even on Microsoft's site like e.g. http://msdn.microsoft.com/en-us/library/ff754351(v=VS.92).aspx. So this is my question:
What exactly is the defined behavior of connecting to localhost from a WP7 app?
Altrernatively, is there a fool-proof way of connecting back to the host-pc?
(Let me stress this again: For this particular purpose I can't use toasts, because the development pc may not even be online.)
Edit:
I work at EQATEC and the application in question is the EQATEC Profiler. Right now the profiler/app-communication is handled by injecting a socket/http-client into the deployed WP7 app that connects back to the profiler's LAN IP address. It works very well and is really fast, but in some very rare cases users are offline and therefore doesn't have an IP, or have some prohibitive lan proxy rules.
Therefore connecting to "localhost" would be excellent if that somehow magically would always work for everybody. It works for me and a couple of test-users, but does it work for all our many thousand profiler users all over the world? I'd like to be more sure.
"localhost" by definition is the machine running the code (well specifically the NIC doing the communication). For either the Phone or the Emulator, that would mean the phone or the emulator, not the PC they are attached to.
When you attach to a PC, you do have a network - it's an RNDIS connection in which both sides get an IP address which traditionally (pre-WP7) could be resolved with 'ppp-peer', though I've not tested that resolution on the Phone. I suspect it will be the same, since WMDC is still what's connecting and they'd have little reason to change that connection mechanism.
If the emulator is resolving localhost to the PC on which is resides, that's a definite bug and I would not count on it continuing to work as they add more robust socket support to the Phone platform.
System.Net.Sockets.Socket isn't really currently available for WP7 programming, but it might be available at some future point (maybe in Mango... maybe...)
AFAIK, the only way to reliably do what you want to do is to set up an http server on the development PC and to provide your app with an HTTP address of that server - or to route messages via some "Cloud proxy"
I'm surprised localhost works at all on the real device... I can only assume that they are asking the connected PC to resolve that DNS name - but even then I'm surprised 127.0.0.1 works.
The ip you're looking for is "192.168.55.100"
That's the ip address the phone uses to connect to the host pc.
If you'd like to connect to the phone, apparently its ip address will be "192.168.55.101"
For the emulator just use localhost or 127.0.0.1
This is from the old ActiveSync days, so I don't know how official it is or how likely it is to last, but for right now at least it worked on my phone.

iPhone - access XAMPP server (localhost) on my mac in the same network

I want to create an iPhone app which makes calls to a web service. For testing, I want to first create the API calls on my mac (server running XAMPP) and if it works fine there I want to port it to the actual server.
If my iPhone and mac are on the same network, can I access the web service using the IP address of my mac?
Thanks.
Any time someone answers with "why not," ignore the post. This just takes up space and adds absolutely no value...their post imitating their life.
Anyway, I access my laptop localhost (WAMP stack) from my iPod Touch by entering the IP address of my laptop on my Touch location bar. There is some configuration that needs to happen for this to work. I found what I needed at:
http://www.frihost.com/forums/vt-88381.html
Good Luck!
I can not speak about actual development, however I access intranet pages from a Ipod Touch all the time by either typing http ://ip or http://local_dns_name
As long as the iphone / ipod is on the network correctly (e.g. through standard wifi and not 3g/whatever) you should be able to access any and all local resources.
What I do:
Connected to the same network, I go in to the wireless settings and create a manual proxy that points to my machine. I use Charles proxy for testing a lot/seeing traffic, works like a charm and it lets me use my macbook hosts file so I don't need to do any funky listening rules in apache - just the same vhost settings I use on my machine already.
http://www.charlesproxy.com/documentation/faqs/using-charles-from-an-iphone/
Why not?
Have you tried it and have some problems?