views:

210

answers:

2

I have got a couple of phones and another couple of PC's connected to a Wifi access point and need to send and receive messages between either of these, I mean anyone can send a message to anyone and receive a message from anyone.
I am willing to write apps on the phones(Symbian OS, S60 platform) or PC(Windows), but what I can't understand is how do I set up a client or server, since any one of these devices could be a client or server.
If I use sockets do I have to script for ServerSockets and also Sockets on each of these devices? Can I use the HTTP protocol? Alternatively any standard protocol that I could use to implement this?

+2  A: 

It seems like you're looking for pretty typical peer-to-peer communication over IP. I suppose other requirements will dictate which transport you use (HTTP, raw sockets, etc), but yes: Each node will be both a client and a server. You could possibly use MDNS (http://www.multicastdns.org/) to help the nodes find eachother in an ad-hoc manner.

dacc
what does this MDNS do? I haven't really understood the concept?
Kevin Boyd
I didn't realize you just wanted to do broadcast. MDNS would allow the nodes (phones, pc) to discover eachother by name in an ad-hoc manner, but that doesn't matter if you just want to broadcast.
dacc
+1  A: 

You would broadcast UDP packets which would arrive at every device on the Wifi network. You would have to invent your own protocol to decide on the identity of each device, since you wouldn't be able to easily infer the IP addresses of your network devices. Without writing an election algorithm you would find it difficult to use a client/server architecture, so just use point-to-point (P2P).

Google for UDP broadcasts and read the relevant RFCs at ietf.org.

Malcolm Sparks
Ah oops, didn't notice the "any to any" part. Yeah, UDP sounds right.
dacc