update server file

This commit is contained in:
build@lguplus.co.kr 2024-01-11 15:52:13 +09:00
parent bd945e5fbe
commit 2af436382e

View file

@ -9,10 +9,13 @@ import 'package:protobuf/protobuf.dart';
abstract class ProtobufServer
{
List<ProtobufClient> _clientList = [];
bool _started = false;
late ServerSocket? _server;
final String _host;
final int _port;
final ProtobufClient Function(Socket) _createNewClient;
bool get started => _started;
ProtobufServer(this._host, this._port, this._createNewClient);
@ -25,6 +28,7 @@ abstract class ProtobufServer
client.addListener(onTemplateData);
_clientList.add(client);
onClientConnected(client);
_started = true;
});
return simpleFuture;
}
@ -56,5 +60,7 @@ abstract class ProtobufServer
Future stop() async {
await _server?.close();
_started = false;
return simpleFuture;
}
}