diff -Naur src/tk/wetnet/j2me/vnc/JHttpTunnelStreamConnection.java src.jhttptunnel/tk/wetnet/j2me/vnc/JHttpTunnelStreamConnection.java --- src/tk/wetnet/j2me/vnc/JHttpTunnelStreamConnection.java 1970-01-01 00:00:00.000000000 +0000 +++ src.jhttptunnel/tk/wetnet/j2me/vnc/JHttpTunnelStreamConnection.java 2005-02-15 06:05:04.000000000 +0000 @@ -0,0 +1,72 @@ +/* -*-mode:java; c-basic-offset:2; -*- */ +/* + * This file is part of J2ME VNC. + * + * Copyright (c) 2005 ymnk, JCraft,Inc. All rights reserved. + * + * J2ME VNC is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * J2ME VNC is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with J2ME VNC; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package tk.wetnet.j2me.vnc; + +import javax.microedition.io.*; +import java.io.*; +import com.jcraft.jhttptunnel.*; + +class JHttpTunnelStreamConnection implements StreamConnection{ + private InputStream in=null; + private OutputStream out=null; + private boolean closed=false; + private JHttpTunnelClient jhtc=null; + JHttpTunnelStreamConnection(String host, int port) throws IOException{ + try{ + jhtc=new JHttpTunnelClient(host, port); + jhtc.setInBound(new InBoundConnector()); + jhtc.setOutBound(new OutBoundConnector()); + jhtc.connect(); + in=jhtc.getInputStream(); + out=jhtc.getOutputStream(); + } + catch(Exception e){ + throw new IOException(e.toString()); + } + } + public void close() throws IOException { + if(closed) throw new IOException( "Closed Stream" ); + try{ + if(jhtc!=null){ + jhtc.close(); jhtc=null; + } + } + catch(Exception e){} + closed=true; + } + public DataInputStream openDataInputStream() throws IOException { +// if(closed) throw new IOException("Closed Stream"); + return new DataInputStream(in); + } + public InputStream openInputStream() throws IOException { +// if(closed) throw new IOException("Closed Stream"); + return in; + } + public DataOutputStream openDataOutputStream() throws IOException { +// if(closed) throw new IOException("Closed Stream"); + return new DataOutputStream(out); + } + public OutputStream openOutputStream() throws IOException { +// if(closed) throw new IOException("Closed Stream"); + return out; + } +} diff -Naur src/tk/wetnet/j2me/vnc/VNC.java src.jhttptunnel/tk/wetnet/j2me/vnc/VNC.java --- src/tk/wetnet/j2me/vnc/VNC.java 2005-02-09 04:09:34.000000000 +0000 +++ src.jhttptunnel/tk/wetnet/j2me/vnc/VNC.java 2005-02-15 06:14:30.000000000 +0000 @@ -218,6 +217,13 @@ httpProxy.getString() ) ); ((tk.wetnet.j2me.httpsocket.HTTPSocket)con).ready(); + + } + else if( shared.isSelected( 3 ) ) { + //#ifdef DEBUG + log( "Use JHttpTunnel"); + //#endif + con=new JHttpTunnelStreamConnection(host, 8888); } else { con = (StreamConnection)Connector. open( "socket://" + host + ":" + port, @@ -509,6 +515,7 @@ shared.append( "#shareddesktop#", null ); shared.append( "#ncm#", null ); shared.append( "#usehttp#", null ); + shared.append( "#jhttptunnel#", null ); try { rs = RecordStore.openRecordStore( "hosts", true );