TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Member1
NA
169
51k
How to fix error ,"Unreachable code detected."
Jul 17 2015 3:17 AM
I written a server program for multiple client connection and I got above error in one method . I tried some options like "
#pragma warning disable "
but it doesn't works. Please give me suggestions to fix this.
Thanks !
here is my code,
public void startServer()
{
int port = Convert.ToInt32(txtport.Text);
string ipaddre = getip();
IPAddress iP = IPAddress.Parse(ipaddre);
TcpListener serverSocket = new TcpListener(iP, port);
TcpClient clientSocket = default(TcpClient);
int counter = 0;
serverSocket.Start();
AppendTxtdata("Server Started , Waiting for Client Connection");
counter = 0;
#pragma warning disable
while (true)
{
counter += 1;
clientSocket = serverSocket.AcceptTcpClient();
AppendTxtdata(" >> " + "Client No:" + Convert.ToString(counter) + " Connected-- IP - "+clientSocket.Client.RemoteEndPoint.ToString()+"");
AppendTxtdata(Environment.NewLine);
handleClient client = new connectSuccess.handleClient();
client.startClient(clientSocket, Convert.ToString(counter));
}
AppendTxtdata("Data sent to Client No :" + Convert.ToString(counter));
clientSocket.Close();
serverSocket.Stop();
AppendTxtdata(" >> " + "exit");
#pragma warning restore
}
Reply
Answers (
0
)
only one usage of each socket address is normally permited.
what is indexe? why we use it?