简体   繁体   English

System.Net.Sockets命名空间中缺少TCPListener

[英]TCPListener missing from System.Net.Sockets namespace

I'm using TCPListener which according to this page should be in System.Net.Sockets, I have 我正在使用TCPListener,根据页面应该在System.Net.Sockets中,我有

using System.Net;
using System.Net.Sockets;
...
TCPListener tcpListener = new TCPListener(10);

Visual Studio is producing the following error Visual Studio产生以下错误

Error 1 The type or namespace name 'TCPListener' could not be found (are you missing a using directive or an assembly reference?) C:\\path\\WindowsService.cs 85 13 Windows Service Test1 错误1找不到类型或名称空间名称'TCPListener'(您是否缺少using指令或程序集引用?)C:\\ path \\ WindowsService.cs 85 13 Windows Service Test1

Did I miss something? 我错过了什么?

You need to spell it correctly: it's TcpListener , not TCPListener . 您需要正确拼写:它是TcpListener ,而不是TCPListener C# is case-sensitive. C#区分大小写。

区分大小写,即TcpListener

Try changing your code to 尝试将代码更改为

using System.Net;
using System.Net.Sockets;
...
TcpListener tcpListener = new TcpListener(10);

C# is case sensitive and the TCP section should be Tcp. C#区分大小写,TCP部分应为Tcp。

HTH 高温超导

OneSHOT OneSHOT

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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