Last active
November 20, 2018 03:37
-
-
Save rsolomo/8779574 to your computer and use it in GitHub Desktop.
trying out a UDP listener in Dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:io'; | |
void main() { | |
RawDatagramSocket.bind('127.0.0.1', 5514, reuseAddress: true).then((value) { | |
value.listen((event) { | |
if (event == RawSocketEvent.READ) { | |
var datagram = value.receive(); | |
print(new String.fromCharCodes(datagram.data)); | |
} | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment