update server file
This commit is contained in:
parent
bd945e5fbe
commit
2af436382e
1 changed files with 6 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue