|
-
April 24th, 2005, 02:58 PM
#1
problem with tcplistener
hi, i'm trying to program a simple server using sockets, and when I initialize the tcplistener i get an exception, and the program halts excution
here's a piece of code
private IPAddress ipadd;
ipadd = Dns.GetHostByName("localhost").AddressList[0];
TcpListener listener;
try{
listener = new TcpListener(ipadd,5000);
listener.Start(); //this is the line of code that gives the Exception
//some more lines of code
}
catch(SocketException error)
{
MessageBox.Show( error.ToString());
}
the thing is that the exception message is
System.Net.Sockets.SocketException ; only one usage of each socket address (protocol,network address,port) is normally permited
then the program halts execution. now my question is the following: why if i'm declaring that listener = new TcpListener(ipadd,5000);
i'm getting this error, i've already tryed the option of TcpListener(5000) and i still get this error
how can i fix it??
-
April 24th, 2005, 05:54 PM
#2
Re: problem with tcplistener
Have you tried with another port number?
Maybe some other application is listening on port 5000.
- petter
-
April 24th, 2005, 05:58 PM
#3
Re: problem with tcplistener
nope..., not yet, hahahahaha, although checking my firewall now says schvhost has that port
dummy me :-)
thanks!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|