FTP Protocol Support

 



 

Overview

 

AdventNet Simulation Toolkit has implemented the FTP client protocol, an optional facility that enables transfer of files between the FTP client and the FTP server. This facility enables the manager to configure an agent by changing the agent configuration files. The agent can use this facility to report any issues to the manager.

 

The file transfer can be done from the Network designer UI or using Jython scripts or through RMI at network startup or during runtime. The mode of transfer may be ascii or binary. The files transferred should have the 'public' access. FTP uses UDP to transfer packets across the network.

 

Transferring files from the Network designer UI

 

To transfer files between the client and the server

Transferring files from Jython Scripts and RMI

 

Simulation Toolkit has implemented methods in RMI and Jython script interface to transfer files between the client and server using FTP, at agent runtime.  These methods are defined in the following script APIs and RMI client APIs in <SimulatorHome>/examples/javadocs directory.

To transfer files between the client and the server

 

This method will upload the 'source' file in the client to the FTP server running at the specified ip address and port number,  in ascii or binary mode using the 'FTP/ftp' protocol. It returns a boolean whether the file is uploaded or not.

      uploadFile(String ipAddress, int port, # String source, String target,  int mode, String protocol, # String user, String password);

where,

 

ipAddress - The host at which the FTP server is running

port - The port in the host at which the FTP server is running

source -  The source file to be uploaded

target - The destination file name

mode - The mode of transfer either '0 for ascii' or '1 for binary'   

protocol - The protocol to be used for uploading file   

user - The user name for the protocol connection

password - The password of the user for the protocol connection

 

This method can be used to download the 'source' file from the FTP server running at the specified ip address and port number, to the client 'target' file in ascii or binary mode using the 'FTP/ftp' protocol.

      downloadFile (String ipAddress, int port, #  String source, String target,  int mode, String protocol), # String user, String password); ;

where,

 

ipAddress - The host at which the FTP server is running

port - The port in the host at which the FTP server is running

source -  The source file to be downloaded

target - The destination file name

mode - The mode of transfer either '0 for ascii' or '1 for binary'   

protocol - The protocol to be used for uploading file   

user - The user name for the protocol connection

password - The password of the user for the protocol connection

 

Refer to section Managing Agents via RMI, to learn more about managing the agent via RMI.

Refer to section Configuring Network Behavior, to learn more about configuring behavior scripts.

 



Copyright © 1996-2006, AdventNet Inc. All Rights Reserved.