The best way to write a server from scratch is probably by using the TINE server wizard. The next best way is to make a copy of a working server and then make modifications to suite the needed functionality. To this end it is instructive to follow the Build Recipe outlined below. In the case of 16-bit Windows servers, the TINE server wizard is not configured to render code. If you render Visual Basic code it will be tailored for use with Visual Basic 6.0 and not Visual Basic 3.0, the differences being in large part that the server control winsrv.vbx in Visual Basic 3.0 does not have (cannot have) methods, hence the generated code in this case will have to be re-worked so as to conform to 16-bit Windows standards. Here it is probably easier to make a clone of the example server presented here and to make modifications as needed.
- Create a working directories for you 16-bit windows client and/or server: for instance G:\WINSRV and G:\WINCLN.
- Go to the TINE distribution and locate the kernel\windows\examples16 subdirectory.
At DESY this is likely to be S:\KERNEL\Windows\examples16. Under this subdirectory you will find separate client and server directories. (the examples also work in 16-bit VB 4.0).
- Choose the SERVER subdirectory. You should now be pointing to for instance: S:\KERNEL\Windows\examples16\SERVER. Copy all the files you see into your G:\WINSRV directory, except note: A copy of winsrv.dll and winsrv.vbx is provided in the example directory for completeness sake. You will most likely not need to copy these files as they will be appropriately distributed and updated via system administration.
- Edit the file fecid.csv and give your server a more meaningful (albeit unique) server name than “MYFEC”
- Create a directory for database files, for example C:\DATABASE. Copy all the *.csv files from G:\WINSRV into C:\DATABASE.
- Make an environment variable FEC_HOME and set it equal to C:\DATABASE\. If the environment variable TINE_HOME has not already been set (via system administration) then make it yourself and set it to point to C:\DATABASE\ as well (don’t forget the trailing “\”).
- Load the project fecsim.mak into VB.30 or VB.40. View the form, find the winsrv.vbx components (there are two) and click on one of them and hit “F4” in order to see its properties. Change the “ExportName” property to a system-wide unique 16-character equipment name. Do the same for the other component.
- Run the server directly in Visual Basic, or make an executable and run the server.
- Go back to the EXAMPLES subdirectory in the TINE distribution and change to the CLIENT subdirectory. You should now be pointing to for instance: L:\KERNEL\Windows\examples16\CLIENT.
Make a client working directory for yourself, for instance WINCLN. Copy all the files you see into your G:\WINCLN directory.
- Load the project sine.mak into VB.30 or VB.40. Edit form_load() to make sure that DEVNAME$ points to your server example’s exported equipment name. Run the example in Visual Basic or make an executable.