[問題] 藍牙使用L2CAP做傳輸的問題??

看板java作者 (TRANS-AM!!!!)時間17年前 (2008/12/31 17:11), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
最近有在研究藍牙程式 因為想使用L2CAP來傳DATA 不過在寫伺服端時有發現到一個問題 以下是server端的一小段 import javax.bluetooth.*; import javax.microedition.io.*; public void start(){ UUID uuid = new UUID("102030405060708090A0B0C0D0E0F011", false); try{ localdev=LocalDevice.getLocalDevice(); System.out.println("Server Start.."); url="btl2cap://localhost:" + uuid.toString() +";ReceiveMTU=512;TransmitMTU=512"; System.out.println("Local find "+localdev.getFriendlyName()); /* 1 */ L2CAPConnectionNotifier n=(L2CAPConnectionNotifier)Connector.open(url); System.out.println("Waiting for connect..."); /* 2 */ L2CAPConnection conn=n.acceptAndOpen(); System.out.println("connect!!!") } catch(Exception e){ } } 照理說程式應該是會執行到 /* 2 */ L2CAPConnection conn=n.acceptAndOpen(); 等待Client連上才對, 可是我執行時卻只會執行到 /* 1 */ L2CAPConnectionNotifier n=(L2CAPConnectionNotifier)Connector.open(url); 後就停住不動, 想請教一下是哪邊有問題嗎?? 參考網站為 http://web.nchu.edu.tw/~jlu/cyut/bluetooth-p.shtml P.S 我用的是bluecove2.0.3 jar 使用eclipseME1.7.9開發 先謝謝指教了 -- 洪日慶: 在家做宅男有啥不好!!想吃就吃!!想睡就睡!!你也可以一樣阿!!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.118.122.160
文章代碼(AID): #19MpSk0x (java)
文章代碼(AID): #19MpSk0x (java)