예제 #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);
        }
    }
예제 #2
0
    // The server initialization method.

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