1

我正在制作一个与蓝牙相关的应用程序来浏览互联网..服务器作为笔记本电脑/台式机,客户端作为手机..我需要在客户端和服务器之间建立连接..但是服务器的执行突然停止在该方法acceptAndOpen()..请帮助解决问题..这是它在服务器端停止的代码:

while (mServerState) {
    StreamConnection btConn = null;
    try {
        updateStatus("[server:] Now waiting for a client to connect");

        //here is the error
        btConn = (StreamConnection) btServerNotifier.acceptAndOpen();

        RemoteDevice dev = RemoteDevice.getRemoteDevice(btConn);


        System.out.println("Remote device address: " + dev.getBluetoothAddress());

        updateStatus("Remote device " + dev.getFriendlyName(true) + "connected");

    } catch (IOException ioe) {

    }
    if (btConn != null) {
        processConnection(btConn);
    }
}
4

0 回答 0