geeta
geeta

Reputation: 689

Communication between PC and android phone using wifi

I want to develop a client server application in which server is on PC having wifi and client application in on android phone. I want to make server application using vc++.Net and client application in android. I am newbie in network programming and i am unable to find any clue about this on internet. And I also don't know is it possible that server is made using vc++.net and client is made using android.

Can anybody please direct me how can i move for this. And if possible please provide me some links related to this.

Any help will be appreciated.

Upvotes: 3

Views: 10810

Answers (1)

Sathish
Sathish

Reputation: 4713

Your question is vague and open to a lot of potentially "correct" answers. First of all, the whole wifi v.s. internet part is irrelevant, you just want to communicate from your Android devices to your pc over the network.

The term to look for is sockets. What you do is listen to particular port on the PC (the "server"). You'll have to open up the relevant ports in the firewall.

You then write an android app that communicates with this server, see here for a proper introduction.

There is no problem using a single socket (ip address + port) to connect with multiple devices, as long as your protocol includes a way for each client to identify itself.

...

That said, you can also do all of this at a higher level, running a SOAP/JSON-based client/server scheme (as opposed to writing your own socket-based protocol). See http://wiebe-elsinga.com/blog/?p=405 for an example.

What is the most appropriate choice depends on your exact requirements (performance, deployment) and your level of experience.

Update

You can use jmDNS to achieve this. It's a really helpful library and once you detect the all devices connected to the same wifi you can get their ip and port so you can establish a connection. You can learn more about how to use it here.

Or you can use Android Wi-Fi Direct API which works only for API Level 14+. Here is more information about the API : Wifi-Direct.

how to achieve transfer file between client and server using java socket

Hope it is what you are looking for! : )

Upvotes: 12

Related Questions