Closed BlackPearl0421 closed 6 days ago
What happens if you specify the IP address of the ftp server in menuconfig?
Well i am using Server IP only
Can You connect to your FTP server using this?
https://github.com/espressif/esp-idf/tree/master/examples/protocols/sockets/tcp_client
IPV4 Address:IP address of FTP Server Port:21
I have the same problem, I use ethernet but not wifi, is this mater? @nopnop2002
@pangpangshui I think it can also be used with Ethernet.
Can you connect to your FTP server via Ethernet using this?
https://github.com/espressif/esp-idf/tree/master/examples/protocols/sockets/tcp_client
IPV4 Address:IP address of FTP Server Port:21
Thanks for reply. I try tcp_clinet, and I get the same error: Socket unable to connect: errno 113, Software caused connection abort
my code is:
static const char *payload = "Message from ESP32 ";
void tcp_client(void)
{
char rx_buffer[128];
char host_ip[] = "192.168.1.11";
int addr_family = 0;
int ip_protocol = 0;
while (1) {
struct sockaddr_in dest_addr;
inet_pton(AF_INET, host_ip, &dest_addr.sin_addr);
dest_addr.sin_family = AF_INET;
dest_addr.sin_port = htons(21);
addr_family = AF_INET;
ip_protocol = IPPROTO_IP;
int sock = socket(addr_family, SOCK_STREAM, ip_protocol);
if (sock < 0) {
ESP_LOGE(TAG, "Unable to create socket: errno %d", errno);
break;
}
ESP_LOGI(TAG, "Socket created, connecting to %s:%d", host_ip, 21);
int err = connect(sock, (struct sockaddr *)&dest_addr, sizeof(dest_addr));
if (err != 0) {
ESP_LOGE(TAG, "Socket unable to connect: errno %d, %s", errno, strerror(errno));
break;
}
ESP_LOGI(TAG, "Successfully connected");
while (1) {
int err = send(sock, payload, strlen(payload), 0);
if (err < 0) {
ESP_LOGE(TAG, "Error occurred during sending: errno %d", errno);
break;
}
int len = recv(sock, rx_buffer, sizeof(rx_buffer) - 1, 0);
// Error occurred during receiving
if (len < 0) {
ESP_LOGE(TAG, "recv failed: errno %d", errno);
break;
}
// Data received
else {
rx_buffer[len] = 0; // Null-terminate whatever we received and treat like a string
ESP_LOGI(TAG, "Received %d bytes from %s:", len, host_ip);
ESP_LOGI(TAG, "%s", rx_buffer);
}
}
if (sock != -1) {
ESP_LOGE(TAG, "Shutting down socket and restarting...");
shutdown(sock, 0);
close(sock);
}
}
}
my ip of esp32 is 192.168.1.10, and the ip of ftp server is 192.168.1.11 @nopnop2002 is there any other error possibility?
and I get the same error: Socket unable to connect: errno 113, Software caused connection abort
There seems to be some problem on the FTP server side.
Can you connect to FTP-Server using Linux standard FTP commands or FileZilla/ffftp?
I can connect ftp server with winscp:
@nopnop2002
And I can't capture packet that port is 21 with wireshark when esp32 connecting to ftp server
Can you connect from a host other than the one where the FTP server is running (192.168.1.11)?
And I can't capture packet that port is 21 with wireshark when esp32 connecting to ftp server
Wireshark cannot capture packets destined for hosts other than itself.
Could you please clarify the following?
FTP server IP:192.168.1.11
IP of the machine where winscp is running?
IP of the machine running Wireshark?
Can you connect from a host other than the one where the FTP server is running (192.168.1.11)?
I try 127.0.0.1 also and it is connected normally;
IP of the machine where winscp is running?
192.168.1.3
IP of the machine running Wireshark?
192.168.1.11
Connect from 192.168.1.3 to 192.168.1.11 ---> OK
Connect from 192.168.1.10(ESP32's ip) to 192.168.1.11 ---> NG
This is strange.
Thanks for reply. I try tcp_clinet, and I get the same error: Socket unable to connect: errno 113, Software caused connection abort
I don't know why tcp_clinet example can't connect to 192.168.1.11. This needs to be resolved. Try this example on both WiFi and Ethernet.
This is My logging and config for tcp_clinet example. 192.168.10.11 is my ftp-server. My ethernet PHY is LAN8720. You will need to change the Ethernet settings to match your PHY.
Successfully connected.
I (367) main_task: Started on CPU0
I (377) main_task: Calling app_main()
I (417) esp_eth.netif.netif_glue: a0:a3:b3:77:b2:77
I (417) esp_eth.netif.netif_glue: ethernet attached to netif
I (1917) ethernet_connect: Waiting for IP(s).
I (2917) esp_netif_handlers: example_netif_eth ip: 192.168.10.120, mask: 255.255.255.0, gw: 192.168.10.1
I (2917) ethernet_connect: Got IPv4 event: Interface "example_netif_eth" address: 192.168.10.120
I (2917) example_common: Connected to example_netif_eth
I (2927) example_common: - IPv4 address: 192.168.10.120,
I (2937) example: Start tcp_client v4
I (2937) example: Socket created, connecting to 192.168.10.11:21
I (3037) example: Successfully connected
I (3047) example: Received 20 bytes from 192.168.10.11:
I (3047) example: 220 (vsFTPd 3.0.3)
I will close this issue. You can Reopen at any time.
Hi,
I am trying to use FTP CLient for my project, and i am getting following error: lwip_connect(54) failed, err=-13 FTP Client Error: Connect, connect: Software caused connection abort lwip_close(54)
i have checked credential of server using Filezilla and its working but in library i get this error, any idea what might be the issue?