Create a new socket connection using Socket.connect()
. Send data over the socket using the Socket write()
method.
import 'dart:io';
main() async {
var socket = await Socket.connect('127.0.0.1', 4041);
print(socket.runtimeType);
socket.write('Hello, World!');
}
扫一扫
在手机上阅读