sftp Sample Program


sftp is a sample LayGO program designed to illustrate the use of the LayGO Device Library. It can be compiled as a 32-bit console mode program for Windows or as a command line program for Solaris or Linux.

sftp uses the device library to initialize a major device and, optionally, a virtual circuit. It then transfers files over the major device or virtual circuit. The default transfer device is an HDLC LAPB connection for error free data transfer. When all of the default values are used, the syntax for sftp is:


    sftp -f d:\upload\*.*


    sftp -r f:\download

In this example, all of the files in d:\upload on the sending machine are copied to f:\download on the receiving machine. sftp finds its default files in the current directory. Additional command-line arguments are described below.


sftp uses the following default values:

Transfer block size        128 bytes
Device database            sftpdev.db
Service database           sftpsrv.db
Configuration file         sftp.cfg
Major device (X.21 bis)    sftp
Minor device               <none>

All defaults can be changed using arguments on the command-line.

Command-line Arguments

Either -? or -h as the first command-line argument prints a usage message.

-b <block size>

-c <file list> arguments are the names of stack configuration files.


    sftp -c sftp.cfg hardware.cfg x21src.cfg -f d:\*.*

sftp will configure the stack using the configuration files
sftp.cfg, hardware.cfg and x21src.cfg.  Configuration files
are loaded in the order given on the command-line.  In case
of multiple files with conflicting configurations, configurations
in files listed later on the command-line override those from
files listed previously.

-d <device database>

-f <file list>

-m <major device>

-n <minor device>

-r <receive path>

-s <service database>

Source Code

C Source Code sftp.c
Linux Makefile makefile
Solaris Makefile makefile
Windows Makefile makefile