Take the 2-minute tour ×

I need to have an android device act as a wifi server/hub that will accept raw data from custom built devices So first off, I need the android device to act as a wifi hub that can accept raw data from my devices. How do I do set that up? I overviewed the code to the tether application, but I don't think that will work. I'll be glad to be wrong, but I don't think It is able to broadcast wifi.

Secondly, do you have any suggestions on how to set up the server. I was looking at Datagram Channels but I didn't see anywhere how to bind them to a port so I'm considering just using a standard server, but I am not sure how to attach it the wifi.

If you have any pointers on either that would be appreciated.


share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You actually have two separate problems, which don't necessarily even both have to be solved with the phone.

The first is to create a wireless network, with either the phone or something else as the managing access point (or to do adhoc wireless). The tether application might be a help with that.

The second is to write an ordinary sockets-based network server to do whatever you want. This would be done either in java essentially as on any other platform, or in a native library essentially as any other sockets-based C environment - the only android unique parts will be activity lifecycle related, getting your code started and keeping it running rather than paused or killed in favor of something else in the foreground.

If your application is specialized enough, you might want to look into rooting the phone. You could then simply write the server in C on the underlying embedded linux (which you could do even without rooting, though it's discouraged) and set the OOM killer values to protect it, and potentially also start it automatically. This may also help with functioning as a wireless network access point - especially if would prefer to not to implement any tether-like NAT capablity from the wireless to the 3g which unauthorized clients might exploit.

You might also want to weigh the benefits of bluetooth vs. wifi and see which is a better fit for your application - not just technically, but in terms of cost/complexity of the embedded devices that will be talking to the phone.

share|improve this answer
add comment

Your Answer


