Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
Hello everyone, Im working with Ethernet Interface on mbed 5 and STM32F407 Seeed Arch Max board. I have a problem with the TCP socket and server. The program return error code -3005 which is "no available socket for use" 1. I successfully created an UDP Socket and it worked perfectly. 2. I changed the target to my STM32F746 discovery code and the TCP server/socket worked also. 3. I used the original code that generated from STM32CubeMX and used LwIP stack, and the TCP server/socket worked.
So I assume that there are no hardware problem, no general TCP problem, it's a problem with mbed on STM32F407. Anypne can help me with this? This is my simple example code that I used:
TCPSocket_Example
#include "mbed.h" #include "EthernetInterface.h" // Network interface EthernetInterface net; // Socket demo int main() { // Bring up the ethernet interface printf("Ethernet socket example\n"); net.connect(); // Show the network address const char *ip = net.get_ip_address(); printf("IP address is: %s\n", ip ? ip : "No IP"); // Open a socket on the network interface, and create a TCP connection to mbed.org TCPSocket socket; socket.open(&net); socket.connect("www.arm.com", 80); // Send a simple http request char sbuffer[] = "GET / HTTP/1.1\r\nHost: www.arm.com\r\n\r\n"; int scount = socket.send(sbuffer, sizeof sbuffer); printf("sent %d [%.*s]\n", scount, strstr(sbuffer, "\r\n")-sbuffer, sbuffer); // Recieve a simple http response and print out the response line char rbuffer[64]; int rcount = socket.recv(rbuffer, sizeof rbuffer); printf("recv %d [%.*s]\n", rcount, strstr(rbuffer, "\r\n")-rbuffer, rbuffer); // Close the socket to return its memory and bring down the network interface socket.close(); // Bring down the ethernet interface net.disconnect(); printf("Done\n"); }