How to write an Android SocketServer to listen on wifi

Posted by xioxox on Stack Overflow See other posts from Stack Overflow or by xioxox
Published on 2011-02-19T22:59:00Z Indexed on 2011/02/19 23:25 UTC
Read the original article Hit count: 175

Filed under:
|
|

I've written a thread using java.net.SocketServer to listen on a particular port. It works fine in the android simulator (using port forwarding). I'm planning to connect over wifi to this port when the app is being used. However, the SocketServer documentation says that if you don't supply an InetAddress, the server listens on localhost.

Am I correct that if I do not supply the address, I will not be able to get a connection over wifi? How can I get the InetAddress of the wifi connection to pass to the SocketServer?

© Stack Overflow or respective owner

Related posts about android

Related posts about sockets