vinh pham - 2009-04-01

Hi there,
I've found a solution to fix this problem but I don't reach to jYMSG package. it's simple using a mathematic. In GUI class's main function, you should do this task follow:
public static void main(String args[]) {
YM ym = new YM(); //YM is name of GUI class
boolean flag = false;
String host = "scsc.msg.yahoo.com"; //Yahoo server
int port = 5050;

ym.setVisible(true);
//Check connection to Yahoo Server every 10s/once
while (true){

Socket socket = null;
try {

socket = new Socket(host,port);
}catch (IOException io){}
//If connection failed
if (socket == null){
flag = true;
ym.logout(); //logout is method in YM class
int timeout = 10;
for (int i=timeout;i>0;i--){
try {
Thread.sleep(1000);
}catch (InterruptedException ie){}
System.out.println("Reconnect after "+i+"s");
}
}
//If connection successed
else {
if (flafg == true) {
ym.login(); //login is method in YM class
flag = false;
}
}
try {
Thread.sleep(1000*10);
}catch (InterruptedException ie){}

} //end while

} //end main

This demo which I've used is YahooClient. (Sorry, I forgot author's name ^^!)