• Post Reply Bookmark Topic Watch Topic
  • New Topic

client/socket design problem  RSS feed

 
mihir maniar
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am having a client /server design where in the client talks to the server via sockets and i am putting code ofboth the client as well as server in the different loop while(true) at respective ends so that they can talk as long as they would like to but the client hangs upon receiving response from server . please guide me what to do.
the client side code is
while(true)
{
temp1=clientbfr.readLine();
//System.out.println(temp);
if(temp1==null)
{

}
else if(temp1.indexOf("Login-")==0)
{
System.out.println(temp1);
}
temp1="";
}

the server side code is the same and that works fine. again if a second clinet requests a socket to the server then that client also hangs. so i think i am not able to view the picture properly. please guide me.
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mihir,
Do not post duplicated threads, you can post as much as you want in
this thread, that you started. Since both of them are referring to the same problem, posting in only one thread might help you to get more replies in group.
 
mihir maniar
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i have done that but then the code just hangs on the client side. please check the following client side code and let me know where am i amaking a mistake.
while(true)
{
temp1=clientbfr.readLine();
//System.out.println(temp);
if(temp1==null)
{

}
else if(temp1.indexOf("Login-")==0)
{
System.out.println(temp1);
}
temp1="";
}

when i click on login on client it hangs but in the command prompt it receives response from the server indicating his/her login status. so i am unable to get the solution for this,please guide me. thank you
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!