Socket ret=null;
    public synchronized Socket createSocket(InetAddress local, InetAddress remote, int port, long timeout) 	throws Exception, Timeout, InterruptedException {	Socket ret=null;		try {	    this.timeout=timeout;	    completed=false;	    start(local, remote, port);	    if(thread == null) 		return null;	    	    thread.join(timeout);	    if(completed == false) {		throw new Timeout();	    }	    if(write_ex != null) {		Exception tmp=write_ex;		write_ex=null;		throw tmp;	    }	    return sock;	}	finally {   // stop the thread in any case	    stop();	}    }