[java] Threading socket handler for two sided communication in tcp port
- by raven
I want to make a chat which will be programed in java.
one computer will host the server and the other one will initiate the socket [tcp port].
now from what I read there should be a loop that will constantly read the socket
which means it will make the code stuck.
I have a button that is 'actionperformed' on mouse release,
I want to know if it will work along with the loops that constantly reads the socket
so that it will also send the infromation I wrote.
If I must thread it, I want to know if the run() method must be void
because if I thread it it will mean creating a new class, and the whole GUI is one big class which includes a text area, and it's private.
also how can I extract the information from the socket directly to the text area?
lets say the textarea variable is called "chatOutput".
thx :)