Link to home
Start Free TrialLog in
Avatar of SaiSeng
SaiSeng

asked on

Socketing One Server n One Client

i hav this applet which has

Quote:
init ()
{
//interface codings
}
void actionPerformed()
{
if (e.getActionCommand=="Host")
{
// i wanted to create serverSocket here but it just seems to be hang here, listening connection, and i couldnt click on any GUI component
}
elseif (e.getActionCommand=="Join")
// so as happen to this after i hav created socket.
}


and how am i suppose to write the socket code??
in order to let the server always listen client, and able to send msg to client
same goes to client, always listen to server, and able to send msg to server

my source's at : http://www.geocities.com/giasens/JavaBingo.zip 
corresponding file in the zip: bing2.java

thanks...
Avatar of Tommy Braas
Tommy Braas
Flag of Australia image

A call to accept() on ServerSocket is blocking, i.e. since you're doing it in your UI code, it WILL make your applet appear to hang.

What exactly are you trying to do?
ASKER CERTIFIED SOLUTION
Avatar of Mayank S
Mayank S
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Please proceed with that recommendation.
Avatar of SaiSeng
SaiSeng

ASKER

sorry ... i just found out i should hav implement thread. btw, thanks :)
>> i just found out i should hav implement thread

That is what I had suggested.