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.
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.
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.
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
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.
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
useful info for chat code
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