You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.
The STM32 DatagramSocket provides the overloaded _SocketBase.available, which calls FreeRTOS_recvcount(). This method is only applicable to TCP sockets (see FreeRTOS doc) and otherwise returns EINVAL.
Example:
import'dart:dartino.ffi';
import'dart:dartino'show sleep;
import'package:socket/socket.dart';
import'package:stm32/ethernet.dart';
main() {
if (Foreign.platform ==Foreign.FREERTOS) initializeNetwork();
DatagramSocket sock =newDatagramSocket.bind("0.0.0.0", 6000);
print("receiving...");
while (true) {
if (sock.available <=0) continue; // this is always true on STM32Datagram datagram = sock.receive();
if (datagram !=null) print("${datagram.sender.toString()}");
}
}
voidinitializeNetwork() {
if (!ethernet.initializeNetworkStack(
constInternetAddress(const<int>[192, 168, 0, 10]),
constInternetAddress(const<int>[255, 255, 255, 0]),
constInternetAddress(const<int>[192, 168, 0, 1]),
constInternetAddress(const<int>[8, 8, 8, 8]))) {
throw"Failed to initialize network stack";
}
while (NetworkInterface.list().first.addresses.isEmpty) {
sleep(10);
}
}
The text was updated successfully, but these errors were encountered:
The STM32
DatagramSocket
provides the overloaded_SocketBase.available
, which callsFreeRTOS_recvcount()
. This method is only applicable to TCP sockets (see FreeRTOS doc) and otherwise returns EINVAL.Example:
The text was updated successfully, but these errors were encountered: