Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 20th, 2012  |  syntax: None  |  size: 0.77 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. how can i create different codes for server and client using following code
  2. BluetoothSerialPortInfo[] info = BluetoothSerialPort.getSerialPortInfo();
  3.  
  4.     try {
  5.         Dialog.alert(info[0].toString());
  6.  
  7.         StreamConnection _bluetoothConnection = (StreamConnection)Connector.open( info[0].toString(), Connector.READ_WRITE );
  8.         DataOutputStream _dout = _bluetoothConnection.openDataOutputStream();
  9.         final int JUST_OPEN = 4;
  10.         _dout.writeInt(JUST_OPEN);
  11.         DataInputStream _din = _bluetoothConnection.openDataInputStream();
  12.         String contents = _din.readUTF();
  13.     System.out.println(contents);
  14.  
  15.         _bluetoothConnection.close();
  16.     } catch (IOException e) {
  17.         // TODO Auto-generated catch block
  18.         e.printStackTrace();
  19.     }      
  20. }