简体   繁体   中英

TcpClient throws Exception calling ".ctor" with "2" argument(s): "No such host is known" in powershell

I'm trying to create a TcpClient object New-Object System.Net.Sockets.TcpClient($Server, $Port) When I use a variable for $Server an exception is thrown but if I statically set the value it works...

I've tried enclosing $Server in quotes, Ensuring there was no whitespace $Server.Trim() and also confirmed $Server is a String

在进一步分析我的脚本后,$server 的值用引号括起来。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM