tags:

views:

612

answers:

4

I'm using TCPListener which according to this page should be in System.Net.Sockets, I have

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

Visual Studio is producing the following error

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

Did I miss something?

A: 

Make sure you have also added a reference to System.Net component.

James
I have, however this should be (according to MSDN in the System assembly)
Unkwntech
TcpListener is in System.dll
Anton Gogolev
Also the way you are constructing your listener object is deprecated, you probably want to use TcpListener(IPAddress addr,int port)
James
+6  A: 

You need to spell it correctly: it's TcpListener, not TCPListener. C# is case-sensitive.

Anton Gogolev
ffs.... not a good way to start the day... guess I still need more coffee
Unkwntech
Use intellisense, if not intelligence.
Will
Heh we've all been there!
JoshBerke
@Will that was a copy/past from a co-worker....
Unkwntech
Intellisense isn't case sensitive tho....surprised you never picked it up...
James
+1  A: 

It's case sensitive, i.e. TcpListener

dove
A: 

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.

HTH

OneSHOT

OneSHOT