パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v5.0.3

udp

Dart向けの軽量で効率的かつ使いやすいUDPライブラリ。ユニキャスト、ブロードキャスト、マルチキャストおよびループバック通信をサポートしています。

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
7730
いいね数
76
Pub ポイント
150

パッケージをインストール

flutter pub add udp

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Dart用の軽量で効率的なUDPライブラリであり、複数プラットフォーム間でのシームレスなユニキャスト、ブロードキャスト、マルチキャスト、ループバック通信を可能にします。低遅延ネットワーキング要件に最適化されており、最小限のオーバーヘッドでUDPパケットの送受信が可能なシンプルなAPIを提供します。ゲーム、IoTデバイス、ローカルネットワーク検出などのリアルタイムアプリケーションに最適です。Android、iOS、macOS、Windows、Linuxをサポートするクロスプラットフォーム対応で、さまざまな展開シナリオに柔軟に対応できます。

用途

  • リアルタイムゲームネットワーキング
  • IoTデバイス通信
  • ローカルネットワークの検出
  • ライブ音声/動画ストリーミング
  • ピアツーピアデータ転送

主な機能

  • ユニキャスト、ブロードキャスト、マルチキャスト、ループバックに対応
  • クロスプラットフォーム互換性
  • 低遅延パケット送信
  • シンプルで直感的な API
  • 効率的なメモリ使用

適している対象

  • リアルタイムアプリを開発する開発者
  • IoTと組み込みシステム
  • ネットワークプロトコルの実験
  • 高速なローカル通信を必要とするアプリ

注意事項

  • 組み込みの信頼性や順序なし
  • パケット損失の慎重な扱いが必要です
  • 保証配信には適していません
  • 制限されたエラー処理
  • 接続状態の手動管理

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Lightweight UDP library for Dart.

Usage

A simple usage example:

import 'package:udp/udp.dart';


main() async {
    // creates a UDP instance and binds it to the first available network
    // interface on port 65000.
    var sender = await UDP.bind(Endpoint.any(port: Port(65000)));
  
    // send a simple string to a broadcast endpoint on port 65001.
    var dataLength = await sender.send("Hello World!".codeUnits,
    Endpoint.broadcast(port: Port(65001)));
  
    stdout.write("$dataLength bytes sent.");
  
    // creates a new UDP instance and binds it to the local address and the port
    // 65002.
    var receiver = await UDP.bind(Endpoint.loopback(port: Port(65002)));
  
    // receiving\listening
    receiver.asStream(timeout: Duration(seconds: 20)).listen((datagram) {
      var str = String.fromCharCodes(datagram.data);
      stdout.write(str);
    });
  
    // close the UDP instances and their sockets.
    sender.close();
    receiver.close();
  
  
   // MULTICAST
    var multicastEndpoint =
        Endpoint.multicast(InternetAddress("239.1.2.3"), port: Port(54321));
  
    var receiver = await UDP.bind(multicastEndpoint);
  
    var sender = await UDP.bind(Endpoint.any());
  
    receiver.asStream().listen((datagram) {
      if (datagram != null) {
        var str = String.fromCharCodes(datagram?.data);
  
        stdout.write(str);
      }
    });
  
    await sender.send("Foo".codeUnits, multicastEndpoint);
  
    await Future.delayed(Duration(seconds:5));
  
    sender.close();
    receiver.close();
  
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。