# Class L2capServer

java.lang.Object
com.codename1.bluetooth.le.L2capServer

public abstract class L2capServer extends Object
A listening L2CAP endpoint on the local device, opened via `BluetoothLE.openL2capServer(boolean)` when acting as a peripheral. Publish `getPsm()` to centrals (typically through a GATT characteristic) so they can connect.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `L2capServer()`
  Constructed by ports; not application API.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract AsyncResource<L2capChannel>`
  `accept()`
  Resolves with the next incoming `L2capChannel`.
  `abstract void`
  `close()`
  Stops listening; pending `accept()` calls fail with `BluetoothError.IO_ERROR`.
  `abstract int`
  `getPsm()`
  The dynamic Protocol/Service Multiplexer the stack assigned to this listener; advertise it to centrals.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### L2capServer

    protected L2capServer()
    Constructed by ports; not application API.

- ## Method Details

  - ### getPsm

    public abstract int getPsm()
    The dynamic Protocol/Service Multiplexer the stack assigned to this listener; advertise it to centrals.

  - ### accept

    public abstract AsyncResource<L2capChannel> accept()
    Resolves with the next incoming `L2capChannel`. Call again after each resolution to accept further channels.

  - ### close

    public abstract void close()
    Stops listening; pending `accept()` calls fail with `BluetoothError.IO_ERROR`.