logo elektroda
logo elektroda
X
logo elektroda

How to upload a file to a server via UDP? Help needed.

Kronosss 570 7
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 18264022
    Kronosss
    Level 4  
    Hi,

    I have started playing around with the module. I have written a program that correctly connects to my home router, from where it connects to the server via WLAN.
    However, I have a conundrum... How do I upload a file to the server?

    At the moment I send the command and I get the answer:
    "425 No data connection".
    Which is logical, as I only have one port open.

    Greetings.
  • ADVERTISEMENT
  • #2 18264573
    khoam
    Level 42  
    Kronosss wrote:
    I started playing around with the WiFi module.
    .
    Which one specifically?

    Kronosss wrote:
    I wrote the program
    .
    Although a snippet of 'problematic' code would be appreciated.
  • ADVERTISEMENT
  • #3 18264647
    Kronosss
    Level 4  
    I work on the cheapest one I could find in the shop.

    The problematic code isn't there yet, after all, as I wrote I don't know how to do it.
    I currently log in to the ftp server with AT commands via port 21:
    AT+CWMODE=1
    AT+CIPMUX=0
    AT+CIPMODE=1
    AT+CWJAP=...
  • Helpful post
    #4 18264819
    khoam
    Level 42  
    Kronosss wrote:
    But how to create a second connection at the same time for a port

    AT+CIPSEND: " This command can only be used in transparent transmission mode which requires single connection "
    Try with AT+CIPSENDEX. Also, if you have set "AT+CIPMUX=0" then it is "single connection mode"

    Documentation: https://www.espressif.com/sites/default/files...entation/4a-esp8266_at_instruction_set_en.pdf
  • ADVERTISEMENT
  • #5 18264849
    Kronosss
    Level 4  
    OK, but how do you mount the second port (data connection) in "AT+CIPMUX=1"?
    And how to switch between these ports?
  • Helpful post
    #6 18264854
    khoam
    Level 42  
    Kronosss wrote:
    And how to switch between these ports?
    .
    By "link ID" in AT+CIPSENDEX.
  • ADVERTISEMENT
  • #7 18264880
    Kronosss
    Level 4  
    Something is not working for me. I am entering the commands:
    AT+CWMODE=1
    AT+CIPMUX=1
    AT+CWJAP=logging into the router
    AT+CIPSTART=...
    I then try to mount the second port and a message appears:
    ERROR
    2,CLOSED

    How should the second port for data be started?
  • #8 18267985
    khoam
    Level 42  
    If you want to send data from the ESP to the server in non-blocking mode, you should use the command AT+CIPSENDBUF . You specify the size of this data and then enter it. The data goes into a buffer from which it will be progressively sent - you can continuously check the status of the sending of this data with the command AT+CIPBUFSTATUS . During this time you can also execute other AT commands, including triggering the sending of other data.

    Unlike AT+CIPSENDBUF, the command AT+CIPSENDEX is a blocking function. You will not be able to execute other commands until the send is complete.

    For multiple TCP connections ( AT+CIPMUX=1 ), use a different syntax for the AT+CIPSTART command:
    Code: Bash
    Log in, to see the code
    .
    where link ID is the identifier of the link in question and can then be used in AT+CIPSEND, AT+CIPSENDEX or AT+CIPSENDBUF commands

    All of the above is described in detail in the documentation I provided a link to in post #4. In addition, I am attaching the document "ESP8266 AT Command Examples", where it is explained how to create Single and Multiple connections for TCP and UDP.

Topic summary

The discussion revolves around uploading a file to a server via UDP using AT commands. The user successfully connects to their home router but encounters a "425 No data connection" error due to only one port being open. Responses suggest using the AT+CIPSENDEX command for single connections and AT+CIPMUX=1 for multiple connections. The user seeks clarification on how to establish a second port for data transfer and how to manage multiple connections. Helpful suggestions include using AT+CIPSENDBUF for non-blocking data transfer and specifying link IDs in the AT+CIPSTART command for multiple TCP connections.
Summary generated by the language model.
ADVERTISEMENT