问题
I want to know how to establish connection in Java between devices within wifi range.
Thanks, in advance.
回答1:
To establish a connection between two devices over a network (WiFi, cable, etc...) you need to write 2 pieces of software:
1) A server: which waits for connections
2) A client: which initiates a connection to the server
Once the client initiates a TCP connection then the devices are connected and you can send data and messages between them.
Here: Java Sockets
Here's a COMPLETE step by step tutorial on how to write a chat application: Client/Server Pair
来源:https://stackoverflow.com/questions/5877450/how-to-connect-to-wifi-devices-using-java