Server socket on Windows Phone 8 and 8.1 - sockets

I need to port an application to the Windows Phone platform. Is it possible to create server sockets on Windows Phone 8 and 8.1? All I've found is related with client side, like creating connections to remote machines. I can't find nothing the other way: The phone acting as the server.
Any help or confirmation on this will be truly appreciated! Thanks in advance!

You'll want to use the StreamSocketListener class.

It is just an opinion of mine, but when I consider my development experience with the Windows Phone I would say: NO. I don't think MS provide an API for that. Also I can't think about a Windows Phone App which acts as a server.
Thanks for downvoting without explanantion.
Just to back up my opinion:
http://msdn.microsoft.com/en-us/library/windows/apps/hh202874(v=vs.105).aspx
There it is very clear, that MS thinks about CLIENT sockets when using them.

Related

Mqtt protocol for windows phone

How to use the mqtt protocol in windows phone.I got code from mqtt site which is an .net application and i am able to run that app successfully,but when i am trying to incorporate the same thing in windows phone i got 3 errors.
1)hashtable is not recognized so i substituted dictonary<>
2)tcpclient is not recognized...can anyone tell me some alternative
3)networkstream is not recognized...
so please can anyone suggest me some alternative for tcpclient and networkstream.
Basically we want to implement push notification without help of mpns in windows phone.
I believe that TCP sockets are now supported for Windows Phone 7 apps (since the Mango SDK update).
Check out http://msdn.microsoft.com/en-us/library/hh202858(VS.92).aspx for a sample and tutorial.
Good luck!

How to create a Mac/PC server app that interacts with iPhone/iPad App?

Can someone please point me in the right direction to create a Mac/PC server app that runs in the background and connects to an iPad app over the local WiFi network?
No matter how I phrase a search on Google it just brings up various apps like Remote Mouse and whatnot and no tutorials or even a hint of where to start.
I just need to send simple commands from iPad to computer over local wifi. A point in the right direction and I can likely fill in the blanks.
Thank you.
Thomas
EDIT: I am using web languages for the iPad version that I will build as a native app using open source tools.
OK, then. It actually depends on what you really need. I made the assumption you need real-time and perhaps binary data transfer.
Your best bet is to write your server application using standard C or C++ so it compiles on both as simply as possible.
If you want to avoid all the burden of writing a protocol for service discovery or asking users to enter the ip address of your server you will use a mDNS implementation for your server and your iPhone app.
If I were you I would try bonjour: http://www.apple.com/support/bonjour/
on iPhone You could start here: http://developer.apple.com/library/mac/#documentation/Networking/Conceptual/NSNetServiceProgGuide/Articles/PublishingServices.html
Once you have your sockets you will have to implement a networking protocol between your server application and your iPhone app.
You will have to be careful about byte ordering and little subtle problems with latency, disconnections and other problems inherent to networking and WiFi.
In windows you will want to register your application as a service and in Mac OS X/UNIX you'll probably want to deamonize it.
Good luck!

if I have an iphone's IP address is there anyway I can communicate with it?

are there any services running by default on an iphone that would let another ip address communicate with it if the iphone's ip is known?
Yes, technically, you can. There are a couple of issues though:
Mobile IP addresses usually change
When the phone is in sleep mode, its network interface is probably not reachable.
So I don't think you can rely on that for initiating a communication with the phone.
There aren't many options out of the box on a non jail-broken phone. However, you can write your own client application that runs on the phone. It accepts or initiates the remote connection.
And in that case, the protocol is entirely up to you.
If you jailbreak your phone, you can install the OpenSSH package and have SSH and SFTP access to your phone.
I don't know exactly what you want to do with your app, but you can consider create a thread detached from the main one (using gcd) and use it to send/receive informations from a server using JSON objects for example. Sure you can use sockets and write a client or something like that.
I suggested a new thread because you can put it running forever (on a enterprise app, I don't know if Apple will approve a thread running on an App for AppStore).
I had to develop an app with a consistent client/server relationship and it was the way I got it working.

communicate between iphone and windows pc?

I want to write an app to communicate between the iPhone and a Windows pc. Where can I find more information on that particular communication?
Your best bet I beleive is to just use the network. If you're doing something nice and simple HTTP might even work for you. If you need to transfer files they NFS or FTP.
I found the following link:
Bonjour for .net
I tested the sample app and it communicates with my iPhone. I will digg more in that on the next day or tow and will inform you.

Question about using Bonjour or other methods to secure a connection with a non computer device

So I have a project I am working on, and I would basically like to send a basic yes/no command from the iPhone to a wifi enabled device that is also connectedto the network on the same router. This other device is not a computer, so I am wondering if I can still use Bonjour? In order to use Bonjour, do both of the communicating devices need to have some sort of a script installed and running that is allowing them to communicate? What would be the best way to connect to this device that is connected to the router, and then to send information/commands to it? I could really use some help finding a direction, because once I identify which tools I need to use, I can research them out and get it done (maybe). If anyone could offer any insight/suggestions whatsoever, it would be greatly appreciated!! Thanks in advance
Bonjour is a local service discovery protocol based on multicast DNS. Even if your device supports it you still need some piece of software on the device to listen to your commands.