Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

client not working perfectly.. please help.  RSS feed

 
Sanjeev Charla
Ranch Hand
Posts: 90
Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in a chat program , client is not working perfectly...
it sends and receives the first message . but after receiving the first message, other messages are not receiving from the server...
when a new instance of the client is created (i.e another user logged on) the first message from that user is sent to all clients.. again further messages are not sent to all clients... please help...


client side:




server side:





 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read this: Don't println to a Socket

Also, this is not a good idea for I/O code, since you won't know if there's a problem:
catch(Exception e) { }
 
Sanjeev Charla
Ranch Hand
Posts: 90
Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir, i cant understand that solution.. please give me in brief.. thank you.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not a solution as such; the article describes the problem you're running into (or at least one of them - there may be more) and provides some strategies for avoiding it. Did you understand what it's talking about?
 
Sanjeev Charla
Ranch Hand
Posts: 90
Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think its about using println method with socket... but so many chat programs are written by using this method.. and they are working good too ... but what about this small program...? ?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean you "think" it's about something? Didn't you read it? The article makes it pretty clear under which circumstances that can be a problem; are you saying those circumstances don't apply to your situation?
 
Rob Spoor
Sheriff
Posts: 21044
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sanjeev charla wrote:and they are working good too ...

Until they port it to a different system, and everything breaks.
 
Sanjeev Charla
Ranch Hand
Posts: 90
Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the mistake is.... i didn't update the iterator.... it is solved... thank you.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!