Sample code for 30+ languages & platforms
Dart Requires Chilkat v11.0.0+

Example: Socket.AcceptNext method

Demonstrates how to call the AcceptNext method.

Chilkat Dart Downloads

Dart
import 'package:chilkat/chilkat.dart';

void main() {
  final listenSocket = CkSocket();
  final connectedSocket = CkSocket();

  final port = 5555;
  final backlog = 25;
  try {
    listenSocket.bindAndListen(port, backlog);
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  // Accept next incoming connection
  var maxWaitMs = 200000;
  try {
    listenSocket.acceptNext(maxWaitMs, connectedSocket);
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  // ...
  // ...

  maxWaitMs = 20000;
  connectedSocket.close(maxWaitMs);
}