Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: How to setup a server-multiple- clientenvironment

  1. #1
    Junior Member
    Join Date
    Jan 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to setup a server-multiple- clientenvironment

    how do i setup a server-multiple-client environment?
    i want to make a chatroom using LAN.

    I am confused with sockets and multicasts classes.
    i dont know which one to use.


  2. #2
    Member wolfgar's Avatar
    Join Date
    Oct 2009
    Location
    the middle of the woods
    Posts
    89
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Re: How to setup a server-multiple- clientenvironment

    i don't know the details of it , but u have to have the server multi-thread listen on the port that each client would connect on

    server
    listen on port xxxx
    when u get a new incoming connection create new thread
    send/receive what ever
    on client close kill thread

    probably something like that i'm still working on a smiler thing here
    Programming: the art that fights back

  3. #3
    Junior Member
    Join Date
    Jan 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to setup a server-multiple- clientenvironment

    thank you for responding.

    so, i have to use serversocket + socket to establish a server client thing.
    then use the thread thing to make it server- multi-client thing.

    something like that?

    and what do you mean by
    "on client close kill thread"?

    and what about multicast?
    do i still have too use it?
    Last edited by jigoku; October 10th, 2009 at 09:45 PM.

  4. #4
    Member wolfgar's Avatar
    Join Date
    Oct 2009
    Location
    the middle of the woods
    Posts
    89
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Re: How to setup a server-multiple- clientenvironment

    idk about the multicast . but the "on client close kill tread" goes to the only way i saw how those are set up , where each accepted connection is handled by a new thread ,then when they disconnect it would leave a useless running thread , and u don't want threads that have no use slowing down the program , so u close/kill it
    Programming: the art that fights back

  5. #5
    Junior Member
    Join Date
    Oct 2009
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: How to setup a server-multiple- clientenvironment

    useful info for chat code

  6. #6
    Junior Member
    Join Date
    Oct 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to setup a server-multiple- clientenvironment

    For Chat Rooms or any Client/server Connecton
    You Can use RMI or Socket programming twice of them are very good
    i think this link will be good for YOU
    CodeProject: Java Chat With Customizable GUI. Free source code and programming help

Similar Threads

  1. traversing multiple jTabbedPane?
    By dewboy3d in forum AWT / Java Swing
    Replies: 3
    Last Post: October 2nd, 2009, 07:26 PM
  2. Breaking out of multiple loops
    By helloworld922 in forum Loops & Control Statements
    Replies: 4
    Last Post: July 1st, 2009, 02:52 PM
  3. Which interface gives more control on serialization of an object?
    By abhishekraok2003 in forum Java Theory & Questions
    Replies: 1
    Last Post: May 16th, 2009, 10:17 AM
  4. Replies: 2
    Last Post: May 16th, 2009, 05:23 AM
  5. [SOLVED] Need to display multiple images from database on a webpage
    By raghuprasad in forum JavaServer Pages: JSP & JSTL
    Replies: 3
    Last Post: May 13th, 2009, 03:15 AM