亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

目錄 搜尋
android Manifest Manifest.permission Manifest.permission_group android.accessibilityservice AccessibilityService android.accounts Account android.app NotificationManager android.bluetooth BluetoothAdapter BluetoothClass BluetoothClass.Device BluetoothClass.Device.Major BluetoothClass.Service BluetoothDevice BluetoothServerSocket BluetoothSocket android.content SharedPreferences android.database.sqlite SQLiteCursorDriver SQLiteOpenHelper android.graphics Bitmap android.location LocationListener Geocoder GpsStatus GpsStatus.Listener GpsStatus.NmeaListener GpsSatellite android.media AudioFormat AsyncPlayer AudioRecord AudioRecord.OnRecordPositionUpdateListener ThumbnailUtils AudioManager android.net TrafficStats MailTo LocalSocket android.os AsyncTask AsyncTask.Status CountDownTimer Message MessageQueue HandlerThread android.text Html android.util JsonWriter android.view ContextMenu ContextMenu.ContextMenuInfo Display ViewManager View ViewStub ViewTreeObserver ViewParent WindowManager GestureDetector Gravity MenuInflater ScaleGestureDetector SoundEffectConstants android.view.inputmethod InputConnection InputMethod InputMethodSession BaseInputConnection InputMethodManager android.widget AbsListView AbsListView.LayoutParams AbsListView.OnScrollListener AbsListView.RecyclerListener AbsoluteLayout AbsoluteLayout.LayoutParams AbsSeekBar AbsSpinner AdapterView AdapterView.AdapterContextMenuInfo AdapterView.OnItemLongClickListener AdapterView.OnItemSelectedListener AdapterView.OnItemClickListener AnalogClock BaseAdapter BaseExpandableListAdapter Button CheckBox CheckedTextView Checkable Chronometer Chronometer.OnChronometerTickListener CompoundButton CompoundButton.OnCheckedChangeListener CursorAdapter CursorTreeAdapter DatePicker DatePicker.OnDateChangedListener DialerFilter DigitalClock EditText Filter Filter.FilterListener Filter.FilterResults ExpandableListAdapter ExpandableListView.OnChildClickListener ExpandableListView.OnGroupClickListener ExpandableListView.OnGroupCollapseListener ExpandableListView.OnGroupExpandListener Filterable Gallery Gallery.LayoutParams GridView GridLayout GridLayout.Alignment RadioGroup ImageView ImageView.ScaleType HorizontalScrollView ImageButton ImageSwitcher FilterQueryProvider ListAdapter ListView MediaController MultiAutoCompleteTextView MultiAutoCompleteTextView.CommaTokenizer MultiAutoCompleteTextView.Tokenizer QuickContactBadge RadioButton RatingBar RatingBar.OnRatingBarChangeListener RelativeLayout RemoteViews ResourceCursorAdapter ResourceCursorTreeAdapter Scroller ScrollView SearchView SearchView.OnCloseListener SearchView.OnQueryTextListener SearchView.OnSuggestionListener SeekBar SeekBar.OnSeekBarChangeListener SimpleAdapter SimpleAdapter.ViewBinder SimpleCursorAdapter SimpleCursorAdapter.CursorToStringConverter SimpleCursorAdapter.ViewBinder SimpleCursorTreeAdapter SimpleCursorTreeAdapter.ViewBinder SimpleExpandableListAdapter SlidingDrawer SlidingDrawer.OnDrawerCloseListener SlidingDrawer.OnDrawerOpenListener SlidingDrawer.OnDrawerScrollListener Spinner SpinnerAdapter WrapperListAdapter TabHost TabHost.TabSpec TextView TimePicker TimePicker.OnTimeChangedListener Toast TableLayout TableLayout.LayoutParams TableRow TableRow.LayoutParams TabWidget TextSwitcher ToggleButton TwoLineListItem VideoView ViewAnimator ViewFlipper ViewSwitcher ViewSwitcher.ViewFactory ZoomButtonsController ZoomButtonsController.OnZoomListener ZoomButton ZoomControls dalvik.system DexFile
文字


BluetoothServerSocket

版本:Android 2.3 r1

?

結(jié)構(gòu)

繼承關(guān)系

public final class BluetoothServerSocket extends Object implements Closeable

????????

java.lang.Object

android.bluetooth.BluetoothServerSocket

?

類概述

???????? 一個(gè)藍(lán)牙監(jiān)聽端口。

???????? 藍(lán)牙端口監(jiān)聽接口和TCP端口類似:SocketServerSocket類。在服務(wù)器端,使用BluetoothServerSocket類來創(chuàng)建一個(gè) 監(jiān)聽服務(wù)端口。當(dāng)一個(gè)連接被BluetoothServerSocket所接受,它會(huì)返回一個(gè)新的BluetoothSocket來管理該連接。在客戶 端,使用一個(gè)單獨(dú)的BluetoothSocket類去初始化一個(gè)外接連接和管理該連接。

???????? 最通常使用的藍(lán)牙端口是RFCOMM,它是被Android API支持的類型。RFCOMM是一個(gè)面向連接,通過藍(lán)牙模塊進(jìn)行的數(shù)據(jù)流傳輸方式,它也被稱為串行端口規(guī)范(Serial Port ProfileSPP)。

???????? 為了創(chuàng)建一個(gè)對(duì)準(zhǔn)備好的新來的連接去進(jìn)行監(jiān)聽BluetoothServerSocket類,使用 BluetoothAdapter.listenUsingRfcommWithServiceRecord()方法。然后調(diào)用accept()方法去監(jiān) 聽該鏈接的請(qǐng)求。在連接建立之前,該調(diào)用會(huì)被阻斷,也就是說,它將返回一個(gè)BluetoothSocket類去管理該連接。每次獲得該類之后,如果不再需 要接受連接,最好調(diào)用在BluetoothServerSocket類下的close()方法。關(guān)閉BluetoothServerSocket類不會(huì)關(guān) 閉這個(gè)已經(jīng)返回的BluetoothSocket類。

???????? BluetoothSocket類線程安全。特別的,close()方法總會(huì)馬上放棄外界操作并關(guān)閉服務(wù)器端口。

???????? 注意:需要BLUETOOTH權(quán)限。

???????? 參見

?????????????????? BluetoothSocket

?

公共方法

public BluetoothSocket accept (int timeout)

???????? 阻塞直到超時(shí)時(shí)間內(nèi)的連接建立。

???????? 在一個(gè)成功建立的連接上返回一個(gè)已連接的BluetoothSocket類。

???????? 每當(dāng)該調(diào)用返回的時(shí)候,它可以在此調(diào)用去接收以后新來的連接。

???????? close()方法可以用來放棄從另一線程來的調(diào)用。

?????????????????? 參數(shù)

?????????????????? ???????? timeout??? (譯者注:阻塞超時(shí)時(shí)間)

?????????????????? 返回值

??????????????????????????? 已連接的 BluetoothSocket

?????????????????? 異常

??????????????????????????? IOException???? 出現(xiàn)錯(cuò)誤,比如該調(diào)用被放棄,或者超時(shí)。

?

public BluetoothSocket accept ()

???????? 阻塞直到一個(gè)連接已經(jīng)建立。(譯者注:默認(rèn)超時(shí)時(shí)間設(shè)置為-1,見源碼)

???????? 在一個(gè)成功建立的連接上返回一個(gè)已連接的BluetoothSocket類。

???????? 每當(dāng)該調(diào)用返回的時(shí)候,它可以在此調(diào)用去接收以后新來的連接。

???????? close()方法可以用來放棄從另一線程來的調(diào)用。

?????????????????? 返回值

??????????????????????????? 已連接的 BluetoothSocket

?????????????????? 異常

??????????????????????????? IOException???? 出現(xiàn)錯(cuò)誤,比如該調(diào)用被放棄,或者超時(shí)。

?

???????? public void close ()

馬上關(guān)閉端口,并釋放所有相關(guān)的資源。

在其他線程的該端口中引起阻塞,從而使系統(tǒng)馬上拋出一個(gè)IO異常。

關(guān)閉BluetoothServerSocket不會(huì)關(guān)閉接受自accept()的任意BluetoothSocket。

異常

IOException


上一篇: 下一篇: