public async Task<bool> Start(string port, string allow = "localhost", string password = "")
{
streamSocketListner = new StreamSocketListener();
streamSocketListner.ConnectionReceived += streamSocketListner_ConnectionReceived;
bool suc = false;
try
{
await streamSocketListner.BindServiceNameAsync(port);
suc = true;
}
catch
{
suc = false;
}
this.password = password;
password_confirmed = string.IsNullOrEmpty(this.password);
switch (allow)
{
case ("lan"):
this.allow = "lan";
break;
case ("any"):
this.allow = "any";
break;
default:
this.allow = "localhost";
break;
}
return suc;
}