{$X+,V-,B-}
program tstconn3;

{ Testprogram for the nwConn unit / NwTP 0.6 API. (c) 1993, 1995, R.Spronk }

{ Purpose: testing of nwConn calls }

{ Tests the following nwConn functions:

  AttachToFileServer
  AttachToFileServerWithAddress (called by AttachToFileServer)

}

uses nwMisc,nwConn;

Var connId,PrimConnId,t:byte;
    serverName:string;

begin
writeln('This program tests the AttachToFileServer call.');
writeln('Can be tested in a multi-server network only.');
getPrimaryConnectionId(PrimConnId);
GetFileServerName(PrimConnId,serverName);
writeln;
writeln('Your primary server is ',serverName,' with connectionId ',PrimConnId);

writeln;
writeln('ConnectionIDtable:');
for t:=1 to 8
 do If GetFileServerName(t,servername)
       and (serverName<>'')
     then writeln('ConnId: ',t:2,' Servername: ',serverName);

writeln;
write('Enter name of new server (not in above list) to attach to:');
readln(servername);
IF NOT AttachToFileServer(serverName,connId)
 then begin
      writeln('AttachtoFileserver returned error: $',HexStr(nwConn.result,2));
      if nwconn.result=$7D
       then writeln(' (wrong servername or server unknown)');
      halt(1);
      end;

writeln;
writeln('ConnectionIDtable:');
for t:=1 to 8
 do If GetFileServerName(t,servername)
       and (serverName<>'')
     then writeln('ConnId: ',t:2,' Servername: ',serverName);

end.