Page 1 of 2 12 LastLast
Results 1 to 20 of 28
  1. #1
    tanu.kansal is offline Member
    Join Date
    Aug 2011
    Posts
    18
    Rep Power
    0

    Post how to do multiclient private chat using socets and threads?

    hello........................
    Last edited by tanu.kansal; 08-25-2011 at 05:12 PM. Reason: giving tags to code

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,518
    Rep Power
    25

    Default

    If you post any code please enclose it in code tags. Use the #icon above the input box.

  3. #3
    tanu.kansal is offline Member
    Join Date
    Aug 2011
    Posts
    18
    Rep Power
    0

    Default

    plzzzz help me out in this problem
    i have studied my code again n i got problem acc. to me when new set of user connected to private chat then server's thread for private chat is replaced by new thread thts why all private messages go to new private chat windows instead of previous private chat windows
    PLZZZZ STUDY PRIVATECONNECTION CLASS, PRIVATEMESSAGE CLASS,CHECKS CLASS IN SERVER FILE and PRIVATE MESSAGE CLASS , CHECK CLASS IN CLIENT FILE

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,305
    Rep Power
    20

    Default

    Check this immediately. Read the whole page.

    db

  5. #5
    tanu.kansal is offline Member
    Join Date
    Aug 2011
    Posts
    18
    Rep Power
    0

    Default

    thnx i hv read but there s nthng related to my work. i m getting problem with threeads
    i want my server to issue a new thread to set of users as user request for private chat but as new set of users requests ffor private chat server is replacing old thread with new thread and all previous msgs also gng to new set of users as public chat plz study my code and help me

  6. #6
    tanu.kansal is offline Member
    Join Date
    Aug 2011
    Posts
    18
    Rep Power
    0

    Default

    how to give tags mr norm

  7. #7
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,518
    Rep Power
    25

    Default

    Use the #icon above the input box. Select your code and press that icon.

  8. #8
    tanu.kansal is offline Member
    Join Date
    Aug 2011
    Posts
    18
    Rep Power
    0

    Default

    k let me post my thread again

  9. #9
    tanu.kansal is offline Member
    Join Date
    Aug 2011
    Posts
    18
    Rep Power
    0

    Default

    mr.norm sir plzz give a look at my code n suggwst me any solution regarding this i am not getn anythng regarding this

  10. #10
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,518
    Rep Power
    25

    Default

    You have posted a lot of code. Too much for most people to want to look through.
    Also The code is mostly unformatted which makes it twice as hard to read. Without proper indentation and alignment of { beneath the line with the beginning { it makes it very hard to read.
    Also there is no comments describing what each section of the code does.
    Also the code does not follow java naming standards: class names begin with Uppercase

    Sorry, I have no interest in trying to read this code and figure out its problems.

  11. #11
    tanu.kansal is offline Member
    Join Date
    Aug 2011
    Posts
    18
    Rep Power
    0

    Default

    ok ok i will do as u say u just check it out after half an hr.

  12. #12
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,518
    Rep Power
    25

    Default

    The way I debug this kind of code is by adding lots of printlns to show the execution flow and the values of variables as they change. By looking at the printouts you can see where the logic is going wrong.
    Have you tried that yet?

    Also you need a "script" or piece of code that will create the classes and call the methods in the correct order and do it automatically so that there is no user intervention required.
    Then to test the code you start the script which does whatever needs to be done to show the problem. You look at the print out,
    see that more print out is needed, add more print outs and run the test again. Eventually you see where the logic problem is.
    You change the code to fix it and run the script. Now the output is correct and you have solved the problem.
    Last edited by Norm; 08-25-2011 at 04:26 PM.

  13. #13
    tanu.kansal is offline Member
    Join Date
    Aug 2011
    Posts
    18
    Rep Power
    0

    Default

    yes sir i had tried tht

  14. #14
    tanu.kansal is offline Member
    Join Date
    Aug 2011
    Posts
    18
    Rep Power
    0

    Default

    somehow i know the problem wht it can be
    i am starting a thread private message after a set of user connect to private chat tht thread contains arraylist containg tht two users socket address and their socket object for creating streams
    but when new set of user is starting private chat previous thread is getting terminated

  15. #15
    tanu.kansal is offline Member
    Join Date
    Aug 2011
    Posts
    18
    Rep Power
    0

    Default

    u plzzz run my code u will automatically get to know the problem because i have added printlns to show ddata flow
    u jst need to run my code u will get to know the problem

  16. #16
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,518
    Rep Power
    25

    Default

    What one class can I start to execute your code? I want to be able to start a single class to demonstrate the problem.

  17. #17
    tanu.kansal is offline Member
    Join Date
    Aug 2011
    Posts
    18
    Rep Power
    0

    Default

    wait plzzzz let me posted login class also for execution

  18. #18
    tanu.kansal is offline Member
    Join Date
    Aug 2011
    Posts
    18
    Rep Power
    0

    Default

    now u just run server file first then server will start running
    then u put login file and client file at same place
    run login file which will automatically run client file u hv to run client file 3 times to make 3 users in chat
    then click on any one user in userlist u will get private chat windows
    till now it will be working fine then u start private chat with third user also then u will see the problem

  19. #19
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,518
    Rep Power
    25

    Default

    now u just run server file first then server will start running
    then u put login file and client file at same place
    run login file which will automatically run client file u hv to run client file 3 times to make 3 users in chat
    then click on any one user in userlist u will get private chat windows
    till now it will be working fine then u start private chat with third user also then u will see the problem
    Can you write code to do all that so all I enter is:
    java StartThePrograms
    and ALL of the above is done automatically

  20. #20
    tanu.kansal is offline Member
    Join Date
    Aug 2011
    Posts
    18
    Rep Power
    0

    Default

    k
    1.javac Server.java
    2.java Server
    3.javac login.java
    4.java login
    5.java login
    6.java login

Page 1 of 2 12 LastLast

Similar Threads

  1. MultiClient with Single Server
    By prince87 in forum Threads and Synchronization
    Replies: 1
    Last Post: 05-01-2011, 01:03 AM
  2. Replies: 7
    Last Post: 06-28-2010, 07:52 AM
  3. How to write in private chat room
    By mischaila in forum New To Java
    Replies: 2
    Last Post: 05-28-2010, 02:07 PM
  4. How to implement private chat application using jsp
    By PortalTeam in forum JavaServer Pages (JSP) and JSTL
    Replies: 9
    Last Post: 02-19-2010, 10:49 PM
  5. multiclient copy
    By thuyduong89dt in forum Networking
    Replies: 0
    Last Post: 12-04-2009, 01:46 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •