Problem connection socket

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


I work with a programming board (SAM3X8E for the microcontroller) and Atmel Studio 7.
I want to send some data from my computer to my programming board using ethernet TCP/IP.


At least I am able to ping my programming board and to detect when I plug or unplung my ethernet wire. I use the library emac to ping my programming card and the library lwip 1.4.0 to create socket.
This is the code of my programming board :


int main(){
    ... //All the initialization
    bool firstTime = true;
struct tcp_pcb *pcb;
        /* To ping the card */
        if (emac_dev_read(&gs_emac_dev, (uint8_t *) gs_uc_eth_buffer, sizeof(gs_uc_eth_buffer), &ul_frm_size) == EMAC_OK) {
            emac_process_eth_packet((uint8_t *) gs_uc_eth_buffer, ul_frm_size);

            pcb = tcp_new();
            tcp_bind(pcb,, 5050);
            pcb = tcp_listen(pcb);
            printf("state of the socket : %s \r\n", getSocketState(pcb->state));
            tcp_accept(pcb, connectionAccepted); // The callback function connectionAccepted just make simple printf to show me that the connection is made
            firstTime = false;
            printf("Socket ready \r\n");

The issue is that when I try to connect thanks to sockets my computer to my programming card I have a time out error...
However when I look with Putty, I have good printf for the creation of my socket :


This is the program from my computer to connect the socket (I am 99% sure that the program is good) :


BAUD_RATE = int(115200)

IP_PORT = 5050
arduino_IP_address =

    if client is None:
        client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        client .settimeout(4)
        client .setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        client .connect((arduino_IP_address, IP_PORT))

except OSError as err:
    print("lol", err)



When I launch this code after the programming card printf that the socket it's ready I have this error :

Can you help me ?


Last Edited: Mon. Jul 5, 2021 - 01:30 PM