我有两台设备连接到Wifi网络(通过路由器或AP)。
第一台设备 - 套接字服务器
第二个设备 - 套接字客户端
问题
服务器端代码:
//Connect to wifi...
public class socketStart extends Thread{
public void run() {
try {
sserver = new ServerSocket(SocketServerPORT);
while (runServer) {
Socket tmp = sserver.accept();
//Read and write over socket ...
客户端代码:
//Connect to wifi..
String ipAddress = "192.168.0.10";//Here manually
public class SocketRead extends AsyncTask<String, String, Void> {
@Override
protected Void doInBackground(final String... params) {
try {
socket = new Socket(ipAddress, SocketServerPORT);
//Read and write over socket