Dart API Referencedart:ioServerSocket

ServerSocket abstract class

abstract class ServerSocket {
  /**
   * Constructs a new server socket, binds it to a given address and port,
   * and listens on it.
   */
  factory ServerSocket(String bindAddress, int port, int backlog) {
    return new _ServerSocket(bindAddress, port, backlog);
  }

  /**
   * The connection handler gets called when there is a new incoming
   * connection on the socket.
   */
  void set onConnection(void callback(Socket connection));

  /**
   * The error handler gets called when a socket error occurs.
   */
  void set onError(void callback(e));

  /**
   * Returns the port used by this socket.
   */
  int get port;

  /**
   * Closes the socket.
   */
  void close();
}

Constructors

factory ServerSocket(String bindAddress, int port, int backlog) #

Constructs a new server socket, binds it to a given address and port, and listens on it.

factory ServerSocket(String bindAddress, int port, int backlog) {
  return new _ServerSocket(bindAddress, port, backlog);
}

Properties

void set onConnection(void callback(Socket connection)) #

The connection handler gets called when there is a new incoming connection on the socket.

void set onConnection(void callback(Socket connection));

void set onError(void callback(e)) #

The error handler gets called when a socket error occurs.

void set onError(void callback(e));

final int port #

Returns the port used by this socket.

int get port;

Methods

void close() #

Closes the socket.

void close();