MT4在*.srv文件中包含服务器详细信息(地址和端口)。对于简单的应用程序,只需获得如下所示的主服务器就足够了
QuoteClient qc = new QuoteClient(2090221607, "OJgYhOfEF8", "demo.mt4tickmill.com", 443);
qc.Connect();
System.out.println("Connected. Balance = " + qc.AccountBalance());
1 void connectExtra() {
2 try {
3 Servers servers = QuoteClient.LoadSrv( "bin\\Debug\\GerchikCo-Demo.srv");
4 QuoteClient qc = Connect(servers.PrimaryServer, servers.SecondaryServers, 67611, "wx1yhpn");
5 System.out.println("Connected to server");
6 } catch (Exception ex){
7 System.out.println(ex.getMessage());
8 }
9 }
10
11 QuoteClient Connect(PrimaryServer primary , SecondaryServer[] slaves, int user, String password) {
12 System.out.println("Connecting...");
13 QuoteClient qc = new QuoteC