使用 ServerSocket 构建网络客户端
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!');
}