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.
Printable View
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
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?
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
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