Exemplo n.º 1
0
    // The DOWNLOAD service routine

    public static void DOWNLOAD(TPSVCINFO rqst)
    {
        if ((rqst.flags & ATMI.TPSENDONLY) == 0)
        {
            TUX.userlog("ERROR: Client not in receive mode");
            ATMI.tpreturn(ATMI.TPFAIL, 0, null, 0, 0); // Return null message as client is not in receive mode
            return;
        }

        string fileName = StringUtils.ReadStringBuffer(rqst.data, rqst.len);

        try
        {
            FileStream fs = File.OpenRead(fileName);
            try
            {
                Send(fs, rqst.cd);
            }
            finally
            {
                fs.Close();
            }
            ATMI.tpreturn(ATMI.TPSUCCESS, 0, null, 0, 0);
        }
        catch (FileNotFoundException eFileNotFound)
        {
            ServerUtils.ReturnReply(ATMI.TPFAIL, 0, eFileNotFound.Message);
        }
    }
Exemplo n.º 2
0
    static void Init()
    {
        TUXDIR = TUX.tuxgetenv("TUXDIR");
        if (TUXDIR == null)
        {
            Console.WriteLine("ERROR: Environment variable TUXDIR not set");
            Environment.Exit(1);
        }

        APPDIR = Environment.CurrentDirectory;

        hasWSL = File.Exists(TUXDIR + "\\bin\\WSL.exe");

        TUXCONFIG = APPDIR + "\\TUXCONFIG";
        if (File.Exists(TUXCONFIG))
        {
            File.Delete(TUXCONFIG);
        }

        TLOG = APPDIR + "\\TLOG";
        if (File.Exists(TLOG))
        {
            File.Delete(TLOG);
        }

        QSPACE = APPDIR + "\\QSPACE";
        if (File.Exists(QSPACE))
        {
            File.Delete(QSPACE);
        }

        TUX.tuxputenv("TUXCONFIG=" + TUXCONFIG);

        FML32.AddFieldTable(TUXDIR + "\\udataobj\\tpadm");
    }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            string TUXDIR = TUX.tuxgetenv("TUXDIR");

            if (TUXDIR == null)
            {
                Console.WriteLine("ERROR: Environment variable TUXDIR not set");
                Environment.Exit(1);
            }

            string APPDIR = Environment.CurrentDirectory;

            string TUXCONFIG = APPDIR + "\\TUXCONFIG";

            string UBBCONFIG = APPDIR + "\\test.ubb";

            Console.WriteLine("Creating " + UBBCONFIG);

            string hostName = Dns.GetHostName().ToUpper();

            StreamWriter ubb = File.CreateText(UBBCONFIG);

            try {
                ubb.WriteLine("*RESOURCES");
                ubb.WriteLine();
                ubb.WriteLine("IPCKEY\t" + 0xCAFE);
                ubb.WriteLine("MODEL\tSHM");
                ubb.WriteLine("MASTER\tmachine");
                ubb.WriteLine();
                ubb.WriteLine("*MACHINES");
                ubb.WriteLine();
                ubb.WriteLine(hostName);
                ubb.WriteLine("\tLMID=machine");
                ubb.WriteLine("\tTUXDIR=\"" + TUXDIR + "\"");
                ubb.WriteLine("\tAPPDIR=\"" + APPDIR + "\"");
                ubb.WriteLine("\tTUXCONFIG=\"" + TUXCONFIG + "\"");
                ubb.WriteLine();
                ubb.WriteLine("*GROUPS");
                ubb.WriteLine();
                ubb.WriteLine("TESTGRP");
                ubb.WriteLine("\tLMID=machine");
                ubb.WriteLine("\tGRPNO=1");
                ubb.WriteLine();
                ubb.WriteLine("*SERVERS");
                ubb.WriteLine();
                ubb.WriteLine("DotServer");
                ubb.WriteLine("\tSRVGRP=TESTGRP");
                ubb.WriteLine("\tSRVID=1");
                ubb.WriteLine("\tCLOPT=\"-- -s TEST DotTux "
                              + "DotTux.Install.TestServer\"");
                ubb.WriteLine();
                ubb.WriteLine("*SERVICES");
            } finally {
                ubb.Close();
            }
        }
Exemplo n.º 4
0
    // The server initialization method.

    public static int tpsvrinit(string[] args)
    {
        TUX.userlog("Welcome to the simple server written in C#");
        return(0);
    }