WiFi-Direct:Android Studio SocketServer接受-连接被拒绝

时间:2018-09-11 17:28:14

标签: android wifi-direct socketserver

我可以使用运行Lollipop 5.1 WiFI Direct的Samsung平板电脑连接到在TI微控制器(cc3220)上运行的套接字服务器。但是我无法以其他方式建立连接。我一直拒绝连接。n这是我在Android上实现套接字服务器的代码。

使用在线示例- http://androidsrc.net/android-client-server-using-sockets-server-implementation/ ++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++

    public static final String IP_SERVER = "192.168.49.1";  // This Android
    public static int PORT = 8988;          

    InetAddress serverAddr = InetAddress.getByName(IP_SERVER); 

//  serversocket = new ServerSocket(PORT, 0, serverAddr);       
    serversocket = new ServerSocket(PORT);      
    serversocket.setSoTimeout(10000);
    socket = serversocket.accept();     

    String message = " IP Addr and Port "
                        + socket.getInetAddress() + ":"
                        + socket.getPort() + "\n";

    Log.v(WiFiDirectActivity.TAG, message);

0 个答案:

没有答案