Code Monkey home page Code Monkey logo

Comments (2)

bo-ms avatar bo-ms commented on May 28, 2024

Hi @CYG01571 looks the packet points (nx_packet_prepend_ptr, etc) are not set correctly, here is my sample how to send data, could you update your code and test again?

VOID tftp_send(UCHAR *data_ptr, UINT data_size)
{
NX_PACKET   *my_packet;
UINT        status;
UINT        packet_length;
ULONG       i;


    /* Loop to send the data.  */
    send_data_length = 0;
    while(send_data_length < data_size)
    {

        /* Allocate a TFTP packet.  */
        status =  nx_tftp_client_packet_allocate(&client_pool, &my_packet, NX_IP_PERIODIC_RATE);
        /* Check status.  */
        if (status)
        {
            printf("ERROR");
            break;
        }

        /* Write ABCs into the packet payload!  */
        if (send_data_length + 512 < data_size)
            packet_length = 512;
        else
            packet_length = data_size - send_data_length;
                                      
        /* Write ABCs into the packet payload!  */
        status = nx_packet_data_append(my_packet, buffer + send_data_length, packet_length, &client_pool, NX_IP_PERIODIC_RATE);

        /* Check status.  */
        if (status)
        {
            printf("ERROR");
            nx_packet_release(my_packet);
            break;
        }

        /* Write this packet to the file via TFTP.  */
        status =  nx_tftp_client_file_write(&client, my_packet, NX_IP_PERIODIC_RATE);

        /* Check status.  */
        if (status)
        {
            printf("ERROR");
            break;
        }

        send_data_length += packet_length;
    }
}

from netxduo.

CYG01571 avatar CYG01571 commented on May 28, 2024

Dear bo-ms,

Thank you for your quickly response!
I resolved this issue for your advice.

I could send a large file to TFTP server!
Your advice was very useful because I didn't notice a thing that I should use nx_packet_data_append() API.

Best Regards.

from netxduo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.