createOneTCP static method

Future createOneTCP(
  1. PortConfig config
)

Implementation

static Future createOneTCP(PortConfig config) async {
  config.uuid = getOneUUID();
  final channel = await Channel.getOpenIoTHubChannel();
  final stub = CommonDeviceManagerClient(channel);
  final response = await stub.createOneTCP(config);
  print('Greeter client received: ${response}');
  channel.shutdown();
  //服务器同步
  PortInfo portInfo = PortInfo();
  portInfo.uUID = config.uuid;
  portInfo.hostUUID = config.device.uuid;
  portInfo.name = config.name;
  portInfo.description = config.description;
  portInfo.bindAllAddr = config.bindAllAddr;
  portInfo.domain = config.domain;
  portInfo.port = config.remotePort;
  portInfo.localPort = config.localProt;
  portInfo.networkProtocol = config.networkProtocol;
  portInfo.applicationProtocol = config.applicationProtocol;
  PortManager.AddPort(portInfo);
}