www.serpro.com CSProX File Transmission CSFileSyncClient / CSFileSyncServer Introduction The CSProX server allows the storage of data, project control, users control, refresh the versions of programs in remote machines, etc. For the data storage the server connects with a relational data base through the ODBC driver. One alternative for not using the CSProX server and the associated relational data base, is to use the file transmission tools described next. Once the files reach their destiny (central computer) it is necessary to concatenate and export them. CSProX has 2 programs to do the transference of files: CSFileSyncClient.exe and CSFileSyncServer.exe. CSFileSyncClient corresponds to the client of transmission and it is used to send/receive information to/from a server. The servers to which it is possible to connect are the server CSFileSyncServer, an FTP server or a Pocket PC connected via ActiveSync. CSFileSyncClient and CSFileSyncServer run under WIN32 and Mobile Windows (5/6). This way it is possible to transmit the data files directly from a Pocket PC on to a remote FTP server via internet or also transmitting the data from a Pocket PC to another. The remote FTP server may be running in Linux and/or Windows. Additionally the CSFileSyncClient for WIN32 is capable of understanding directly with ActiveSync with no need of installing a server (Ftp Server or CSFileSyncServer) in the Pocket PC. CSFileSyncClient uses the parameter file CSFileSyncClient.ini (located in the same file as the executable) to determine the actions it will follow. CSFileSyncServer uses the parameters file CSFileSyncServer.ini (located in the same file as the executable). As an option the parameter “/Start” can be used for the program to start immediately without showing the initial dialog of confirmation. Using these programs it is possible to control in the recovery of information from remote computers and the actualization of applications. CSFileSyncClient and CSFileSyncServer configuration manual 1 www.serpro.com Figure 1: CSFileSyncClient initial dialog example Figure 2: CSFileSyncServer initial dialog example CSFileSyncClient and CSFileSyncServer configuration manual 2 www.serpro.com CSFileSyncClient configuration The CSFileSyncClient performs 3 functions: Connecting to a server (FTP, CSFileSyncServer or ActiveSync running on a Pocket PC) Copying information to the server (normally the data is sent to a server) Copying information from the server (normally actualizations to the data capture application are obtained) Therefore it is necessary to define the actions required in a configuration file named CSFileSyncClient.ini The CSFileSyncClient.ini may be created or modified using a text editor, for example, notepad. The structure of the file is the following: 1) The commentaries are specified by starting the line with a period(.) and may be located anywhere in the file. Example: .Configuration of parameters of survey number 2 .This is another comment line 2) Heading (CSFileSyncClient): [CSFileSyncClient] Version=CSPro 3.3 This section only permits one parameter (Version) that contains the actual version of the system. 3) Server connection parameters (SERVER): [SERVER] Label= Address= Port= User= Pwd= CSFileSyncClient and CSFileSyncServer configuration manual 3 www.serpro.com This section has 5 parameters: Label that contains a reference text, Address that contains the server’s address, Port that contains the number of the port where the server is running, User holds the user name and Pwd has the corresponding password. The first parameter (Label) is only a reference text (it may be blank). Example: Label=Server for field survey number 2 The address (Address) may be specified in different ways depending on the type of server on to which you are connecting: a) Activesync When we want to connect to a Pocket PC that is connected to our machine (WIN32) through ActiveSync, the address field has to be left blank: Address= b) CSFileSyncServer In this case you have to specify the IP number of the server Example: If the server CSFileSyncServer is running in a machine (WIN32 or PocketPC) with an IP number 192.168.1.2, the address has to contain this number. Address=192.168.1.2 c) FTP server In this case you have to specify the full server address or the corresponding IP number. Example: Address=ftp.myserver.com The Port corresponds to the port in which the server is running and may be specified in different ways, depending on the type of server on which we are going to connect: CSFileSyncClient and CSFileSyncServer configuration manual 4 www.serpro.com a) Activesync When we want to connect to a Pocket PC that is connected to our machine (WIN32) through Activesync, the field Port has to contain the word ActiveSync. Port=ActiveSync b) CSFileSyncServer o FTP Server In this case the corresponding port needs to be specified. Typically the FTP servers run on port 21. Example: Port=21 Finally, the parameters User and Pwd correspond to the user and password respectively. They may be specified in different ways depending on the type of server you want to access: a) Activesync When we want to connect to a Pocket PC that is connected to our machine (WIN32) through Activesync, you mast leave the fields User and Pwd with the word “anonymous”. User= anonymous Pwd= anonymous b) CSFileSyncServer o FTP Server In this case the user/password needs to be specified. Example: User=John Pwd=John1234 If User and/or Pwd are left blank, the initial connection dialog will ask for them. CSFileSyncClient and CSFileSyncServer configuration manual 5 www.serpro.com 4) Section for specifying files to be sent (upload) to the server (PUT). Zero or more PUT sections may be specified.. [PUT] LocalFiles= LocalDir= RemoteDir= This section has 3 parameters: LocalFiles that contain a list of file names, LocalDir, contains the name of the local directory where the files are located and RemoteDir that corresponds to the name of the remote directory where the files will be copied. RemoteDir is a directory relative to the directory specified in CSFileSyncServer (parameter StartDir) or to the root directory of the FTP server. In LocalFiles you may specify one or more file names separated by a semicolon (;) . Aditionaly you may specify expression with meta characters (“*” and “?”) for the names of the files. For example, in order to send all the data files from the local folder “\My Documents\Survey2\Data” in the Pocket PC to the remote folder “Survey2\Data” in the server, you would use the following: [PUT] LocalFiles=*.DAT LocalDir=\My Documents\Survey2\Data RemoteDir=Survey2\DATA If we are connecting to CSFileSyncServer and the parameter StartDir in CSFileSyncServer.ini is “C:\Projects” (see ahead the parameters for CSFileSyncServer), so the files will be copied in the directory “C:\Projects\Survey2\DATA” in the server. It is important to observe that if the remote server is a FTP server running under an OS that distinguishes uppercase from lowercase in the file names (Linux, for example), then the directory “Survey2\DATA” is different than “SURVEY2\DATA” and “Survery2/data”. 5) Section for specifying files to be obtained (downloaded) from a server (GET). Zero or more GET sections may be specified. [GET] RemoteFiles= CSFileSyncClient and CSFileSyncServer configuration manual 6 www.serpro.com RemoteDir= LocalDir= This section has 3 parameters: RemoteFiles that contains a list of file names, RemoteDir that contains the name of the remote directory where the files are located and the LocalDir that corresponds to the name of the local directory where the files will be copied. In RemoteFiles you can specify one or more file names separated by a semicolon (;) . An expression may not be specified with meta characters except if the connection is to a Pocket PC via Activesync. Example 1: To copy the binary applications of the survey “Survey2” located in the remote directory “survey2\APP” to the local directory “..\app”, uses the following: [GET] RemoteFiles=Survey2.APP.bin; Survey2.fmf.bin; Survey2.mgf.bin; Survey2.qsf.bin; Survey2.ent; Survey2.pff RemoteDir=survey2/APP LocalDir=..\app Example 2: To copy all the data files located in the directory “\My Documents\Survey2\Data” from a Pocket PC connected via Activesync to the local directory “C:\Survey\Data” the following is used: RemoteFiles=*.DAT LocalDir=C:\Survey2\Data RemoteDir=\My Documents\Survey2\Data This is the typical example in which a supervisor wants to recover the data from a Pocket PC. Since we are using Activesync, it is possible to use meta characters in RemoteFiles. 6) Uso of macros In both sections GET and PUT it is possible to use macros that expand at the time of executing. You can use more than one macro per line. The macros are the following (notice that they start and end with a percentage sign): %MACHINENAME%, it expands with name of the machine (in WIN32 corresponds to the host name) CSFileSyncClient and CSFileSyncServer configuration manual 7 www.serpro.com %MACHINEID%, it expands with the internal identifier of the machine. %USER%, it expands with the name of the user specified in section SERVER parameter User. %DATE%, it expands with the machine date. The format is YYYYMMDD. %TIME%, it expands with the machine time. The format is HHMMSS. %REMOTEMACHINENAME%, it expands with the name of the remote Pocket PC. %REMOTEMACHINEID%, it expands with the internal identifier of the remote Pocket PC. Warning: Given that the machine names may be changed by the users and the machine identifiers may not be unique (MachineId/RemoteMachineId), we recommend to control with other means (control menu) that the machine names are unique and that they are not changed during the course of a project. By doing this you can use the macros %MACHINENAME% and %REMOTEMACHINENAME% with no problems as part of the directories names. The macros %REMOTEMACHINENAME% and %REMOTEMACHINEID% only work with Activesync connections and with CSFileSyncClient executed in WIN32. The file deviceid.dll (included in the distribution kit) must be located in the root directory of the Pocket PC. Additionally in the section SERVER (parameter User and Pwd), those macros may be used except for %USER%, %REMOTEMACHINENAME% y %REMOTEMACHINEID%. Example 1: If we assume that the actual date is December 20, 2012 and the time Is 17:05:11 then: RemoteDir =MyFile_%DATE%_%TIME%.zip will expand as: RemoteDir =MyFile_20121220_170511.zip Example 2: assuming the same date and that we are connecting to the server with user name “John” then: RemoteDir =Data\%USER%_%DATE% will expand as: RemoteDir =Data\John_20121220 CSFileSyncClient and CSFileSyncServer configuration manual 8 www.serpro.com Example 3: if we assume that the Pocket PC has an internal name WM_PC12 and an internal identifier CC24A41C0B0C859662D2 then: LocalDir =Data\%REMOTEMACHINENAME%_%REMOTEMACHINEID% will expand as: LocalDir =Data\ WM_PC12_CC24A41C0B0C859662D2 Remember that the macros %REMOTEMACHINENAME% and %REMOTEMACHINEID% only work when Activesync is active and only under WIN32. In the case of connection via ActiveSync, if the local machine directory doesn’t exist then it will be created automatically. A good use of the macros will allow to keep – in a simple way - all the data for each machine in different directories. CSFileSyncClient and CSFileSyncServer configuration manual 9 www.serpro.com CSFileSyncServer configuration While it is possible to use CSFileSyncClient with an FTP server, there is also the option to use CSFileSyncServer that runs both in WIN32 as well as in Windows Mobile. On the other hand, CSFileSyncServer is a bit more efficient than a FTP server since the files will only be transferred if they have suffered modifications (if the MD5 of the local file is different than the MD5 of the remote file, then the transmission will take place). The great advantage of the FTP servers is that there are a lot of tools to administer them in a very simple way. Additionally it may run under different operating systems. The CSFileSyncServer has 2 functions: Check users/password Process the GET/PUT requirements from the clients The configuration file is called CSFileSyncServer.ini and it may be created or modified using a text editor, for example, notepad. The file structure is as follows: 1) The comments are specified by starting the line with a period (.) and may located in any place in the file Example: .Server for survey 2 .This is another comment line 2) Heading (CSFileSyncServer): [CSFileSyncServer] Version=CSPro 3.3 This section only permits one parameter (Version) that contains the actual system version. 3) Server starting parameters (TCP): [TCP] CSFileSyncClient and CSFileSyncServer configuration manual 10 www.serpro.com Port= StartDir= Welcome= This section has 3 parameters: Port, contains the number of the port where the server will run, StartDir corresponds to the root directory where the server will start and Welcome contains a welcome text for those clients who get connected. In the Port parameter the port number for the server is specified. The clients must point to the same port in order to connect (see parameter SERVER/Port in CSFileSyncClient.ini). Example: Port=3333 The parameter StarDir contains the servers’ root directory. The GET/PUT client’s requirements will be relative to this folder. Example: StartDir=C:\Survey2 The directory C:\Survey2 must exist in the server and must have enough privileges so that the clients may read or write information. Finally in the Welcome parameter a welcome text is specified for the clients (it may be left blank). Example: Welcome=Welcome to the server for survey number 2 4) Users (USER). One or more sections USER may be specified (one section by user). [USER] User= Pwd= This section has 2 parameters: User to specify the name and Pwd to specify the the corresponding password. CSFileSyncClient and CSFileSyncServer configuration manual 11 www.serpro.com Example: [USER] . User 1 User=John Pwd=John1234 [USER] . User 2 User=Peter Pwd=zKjle7 To allow a client to connect to the server, the User/Pwd parameters specified in CSFileCynClient.ini (section SERVER) must match with some of the USER section specified above. CSFileSyncClient and CSFileSyncServer configuration manual 12 www.serpro.com Appendix 1: CSFileSyncClient.ini examples We will assume: 12 working teams each of them composed by 1 supervisor using a Netbook with internet connection and 5 interviewers using Pocket PC. The supervisors will be the only ones that will connect to the FTP server. The FTP server will be called ftp.myserver.com, the user will be John and the password John1234. Other user names may be defined for the other supervisors. The directory structure in the FTP server is: o Projects\Survey2\APP mantains the applications o Projects\Survey2\DICTS mantains the dictionaries o Projects\Survey2\SYNC mantains the data sent by the supervisors. There are 12 subdirectories, one for each supervisor. The structure of the directories in the supervisors machine is: o C:\Survey2\App mantains the applications o C:\Survey2\Dicts mantains the dictionaries o C:\Survey2\Data mantains the data files o C:\Survey2\Sync mantains the configuration files .ini and deviceid.dll. o C:\Survey2\Sync\PPC mantains the data files from the Pocket PC. One subdirectory will be generated for each Pocket PC (5 subdirectories, one for each interviewer) The structure of the directories in the interviewer machine (Pocket PC) is: o \My Documents\Survey2\App mantains the applications o \My Documents\Survey2\Dicts mantains the dictionaries o \My Documents\Survey2\Data mantains the data files CSFileSyncClient is executed in the supervisor’s machine which has a pocket PC connected. The local execution directory is: C:\Survey2\Sync. The .ini files will be named CSFileSyncClient_Supervisor_Pocket.ini and CSFileSyncClient_Supervisor_Servidor.ini. The application menu (not described in this document) will be in charge of copying the corresponding file to CSFileSyncClient.ini and then will execute the program CSFileSyncClient.exe. CSFileSyncClient and CSFileSyncServer configuration manual 13 www.serpro.com a) Communication between supervisor’s machine with Pocket PC via Activesync To up/down load information from the supervisor’s machine onto a PocketPC the CSFileSyncClient_Supervisor_Pocket.ini will be used. It has the following structure: [CSFileSyncClient] Version=CSPro 3.3 [SERVER] Label=It connects Pocket PC via ActiveSync Address= Port=ActiveSync User=anonymous Pwd=anonymous .*********** Copy files from Supervisor’s machine onto a PocketPC [PUT] LocalFiles=SURVEY2.APP.bin;SURVEY2.fmf.bin;SURVEY2.mgf.bin;SURVEY2.qsf. bin;SURVEY2.ent;SURVEY2.pff LocalDir=..\App RemoteDir=\My Documents\Survey2\App [PUT] . We assume that our application uses 2 dictionaries LocalFiles=SURVEY2.dcf.bin;Sample.dcf.bin LocalDir=..\Dicts RemoteDir=\My Documents\Survey2\Dicts [PUT] . We copy other additional files (for example, the sample files) LocalFiles=Sample.dat;Sample.dat.idx LocalDir=..\ RemoteDir=\My Documents\Survey2 [PUT] . In case the .dll deviceid.dll is not copied onto the Pocket PC root, we copy it: LocalFiles=deviceid.dll LocalDir=..\Sync RemoteDir=\ .*********** Copy data files from the Pocket PC to the supervisor machine [GET] RemoteFiles=*.dat CSFileSyncClient and CSFileSyncServer configuration manual 14 www.serpro.com RemoteDir=\My Documents\Survey2\Data LocalDir=..\Sync\PPC\%REMOTEMACHINENAME%_%REMOTEMACHINEID% CSFileSyncClient and CSFileSyncServer configuration manual 15 www.serpro.com b) Communication between the supervisor’s machine and a FTP server To up/down load information from the FTP server to the supervisor’s machine, will use the file CSFileSyncClient_Supervisor_Central.ini which has the following structure: [CSFileSyncClient] Version=CSPro 3.3 [SERVER] Label=Central FTP Server Address=ftp.myserver.com Port=21 . If user and/or Pwd are left blank, the initial dialog will ask for User=John Pwd=John1234 [GET] . It is better to copy the .ini file from the central in case you want to make future modifications. RemoteFiles=CSFileSyncClient_Supervisor_PPC.ini RemoteDir=Projects/Survey2/SYNC LocalDir=..\Sync [GET] . It is better to copy the .ini file from the central in case you want to make future modifications. RemoteFiles=CSFileSyncClient_Supervisor_Central.ini RemoteDir=Projects/Survey2/SYNC LocalDir=..\Sync .Binaries applications [GET] RemoteFiles=SURVEY2.APP.bin;SURVEY2.fmf.bin;SURVEY2.mgf.bin;SURVEY2.q sf.bin;SURVEY2.ent;SURVEY2.pff RemoteDir=Projects/Survey2/APP LocalDir=..\App .Binaries dictionaries [GET] RemoteFiles=SURVEY2.dcf.bin;Sample.dcf.bin RemoteDir=Projects/Survey2/DICTS LocalDir=..\Dicts . The sample files CSFileSyncClient and CSFileSyncServer configuration manual 16 www.serpro.com [GET] RemoteFiles=Sample.dat;Sample.dat.idx RemoteDir=Projects/Survey2 LocalDir=..\ . Other files, for example, deviceid.dll [GET] RemoteFiles=deviceid.dll RemoteDir=Projects/Survey2/SYNC LocalDir=..\sync . Other non binaries files for the supervisor [GET] RemoteFiles=SURVEY2.app;SURVEY2.fmf;SURVEY2.mgf;SURVEY2.qsf RemoteDir= Projects/Survey2/APP LocalDir=..\App .Other non binaries files for the supervisor [GET] RemoteFiles=superv_menu.app RemoteDir= Projects/Survey2/APP LocalDir=..\App .Other non binaries files for the supervisor [GET] RemoteFiles=SURVEY2.dcf;Sample.dcf RemoteDir= Projects/Survey2/DICTS LocalDir=..\Dicts .Copy ZIP data to the server. Typically those .zip are generated using CSFileConcat and then some compression utility. The idea is to concatenate all the data that comes from Pocket PCs (which are already in the supervisors machine) onto a single file (AllData.dat) and then compress it for its later transmission. The application menu (not described in this document) will be in chargedof performing some of these tasks using –among others- the ExecSystem function. This way 2 zips will be generated: one without the date and one with the date to be left in the FTP server’s history. .The zip files will be copied onto the respective supervisor’s directory in the FTP server. The %MACHINENAME% macro expands with the Host Name and it is fundamental that all the supervisor’s machines have different machine names and that they are not changed in the course of a project. [PUT] LocalFiles=AllData.zip LocalDir=..\Sync CSFileSyncClient and CSFileSyncServer configuration manual 17 www.serpro.com RemoteDir=Projects/Survey2/SYNC/%MACHINENAME% [PUT] LocalFiles=AllData_%DATE%.zip LocalDir=..\Sync RemoteDir=Projects/Survey2/SYNC/%MACHINENAME% CSFileSyncClient and CSFileSyncServer configuration manual 18 www.serpro.com Appendix 2: CSFileSyncServer.ini example [CSFileSyncServer] Version=CSPro 3.3 [TCP] Port=3333 StartDir=C:\Survey Welcome=Welcome to the server for the survey number 2 .User list [USER] User=John Pwd=John1234 [USER] User=Peter Pwd=zKjle7 CSFileSyncClient and CSFileSyncServer configuration manual 19