version 1.3, 2000/09/08 07:29:45 |
version 1.6, 2001/01/28 19:17:24 |
|
|
/** |
/** |
* $OpenXM: OpenXM/src/OpenMath/ORG/openxm/tam/OpenXM.java,v 1.2 2000/09/07 11:07:01 tam Exp $ |
* $OpenXM: OpenXM/src/OpenMath/ORG/openxm/tam/OpenXM.java,v 1.5 2000/10/11 08:32:15 ohara Exp $ |
*/ |
*/ |
package ORG.openxm.tam; |
package ORG.openxm.tam; |
|
|
Line 13 import java.net.*; |
|
Line 13 import java.net.*; |
|
* 接続するサーバ毎に一つの OpenXM クラスが必要. |
* 接続するサーバ毎に一つの OpenXM クラスが必要. |
*/ |
*/ |
public class OpenXM{ |
public class OpenXM{ |
private OpenXMconnection control = null, stream = null; |
private OpenXMstream control = null, stream = null; |
final protected boolean debug = false; |
final protected boolean debug = false; |
|
|
/** |
/** |
Line 22 public class OpenXM{ |
|
Line 22 public class OpenXM{ |
|
* ポート番号 StreamPort にデータ用の接続を行なう. |
* ポート番号 StreamPort にデータ用の接続を行なう. |
*/ |
*/ |
public OpenXM(String host,int CtrlPort,int StreamPort) throws IOException{ |
public OpenXM(String host,int CtrlPort,int StreamPort) throws IOException{ |
control = new OpenXMconnection(host,CtrlPort); |
control = new OpenXMstream(host,CtrlPort); |
|
|
try{ |
try{ |
Thread.sleep(100); // We need a few wait for starting up server. |
Thread.sleep(100); // We need a few wait for starting up server. |
Line 30 public class OpenXM{ |
|
Line 30 public class OpenXM{ |
|
System.err.println(e.getMessage()); |
System.err.println(e.getMessage()); |
} |
} |
|
|
stream = new OpenXMconnection(host,StreamPort); |
stream = new OpenXMstream(host,StreamPort); |
|
|
control.sendByteOrder(); |
control.sendByteOrder(); |
stream.sendByteOrder(); |
stream.sendByteOrder(); |
} |
} |
|
|
/** |
/** |
|
* コマンド command を立ち上げ、 |
|
* OpenXM サーバとの接続を TCP/IP ソケットを用いて行なう. |
|
* マシン名 host のポート番号 CtrlPort にコントロールを, |
|
* ポート番号 StreamPort にデータ用の接続を行なう. |
|
*/ |
|
public OpenXM(String command,String host,int CtrlPort,int StreamPort) |
|
throws IOException{ |
|
Runtime.getRuntime().exec(command); |
|
control = new OpenXMstream(host,CtrlPort); |
|
|
|
try{ |
|
Thread.sleep(100); // We need a few wait for starting up server. |
|
}catch(InterruptedException e){ |
|
System.err.println(e.getMessage()); |
|
} |
|
|
|
stream = new OpenXMstream(host,StreamPort); |
|
|
|
control.sendByteOrder(); |
|
stream.sendByteOrder(); |
|
} |
|
|
|
/** |
* 接続の初期化を行なう. 現在は未実装. |
* 接続の初期化を行なう. 現在は未実装. |
*/ |
*/ |
public synchronized void resetConnection(){ |
public synchronized void resetConnection(){ |
Line 87 public class OpenXM{ |
|
Line 110 public class OpenXM{ |
|
|
|
for(int i=0;i<argv.length;i++){ |
for(int i=0;i<argv.length;i++){ |
if(argv[i].equals("-h")){ |
if(argv[i].equals("-h")){ |
System.out.println(""); |
System.err.println(""); |
System.exit(0); |
System.exit(0); |
}else if(argv[i].equals("-host")){ |
}else if(argv[i].equals("-host")){ |
hostname = argv[++i]; |
hostname = argv[++i]; |
Line 161 public class OpenXM{ |
|
Line 184 public class OpenXM{ |
|
e.printStackTrace(); |
e.printStackTrace(); |
} |
} |
|
|
System.out.println("breaking..."); |
System.err.println("breaking..."); |
|
|
try{ |
try{ |
// close connection |
// close connection |