lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] lwIP 1.4.0 sockets bug? Not receiving packets on connect


From: David Buzz Carlson
Subject: [lwip-devel] lwIP 1.4.0 sockets bug? Not receiving packets on connect
Date: Wed, 08 Feb 2012 21:11:02 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0

Hello,

I am seeing unexpected behavior using lwIP on an STM32 platform running the chibiOS kernel/hal. I am trying to open a socket to a server that immediately sends a handshake upon connection initiation. The code looks like this:

    my_sock = lwip_socket(AF_INET, SOCK_STREAM, 0);
    opt = 2500;
ret = lwip_setsockopt(my_sock, SOL_SOCKET, SO_RCVTIMEO, &opt, sizeof(int)); ret = lwip_connect(my_sock, (struct sockaddr*)&my_conn, sizeof(my_conn));
    if(ret != 0) {
        lwip_close(my_sock);
        return BAD_CONN;
    }
    ret = lwip_read(my_sock, m_buf, BUF_SIZE);
    if(ret < 24) {
chprintf((BaseChannel *)&SD1,"Did not read expected 24 bytes: %d\n", ret);
    }

The lwip_read function is always returning -1 even though tcpdump is showing that packets are being sent:

20:50:11.145020 IP comp.local.3000 > 192.168.0.89.49161: Flags [FP.], seq 1:70, ack 2, win 14600, length 69 20:50:17.161010 IP comp.local.3000 > 192.168.0.89.49161: Flags [FP.], seq 1:70, ack 2, win 14600, length 69 20:50:19.097013 IP comp.local.3000 > 192.168.0.89.49160: Flags [FP.], seq 1:70, ack 2, win 14600, length 69 20:50:23.221211 IP comp.local.3000 > 192.168.0.89.49162: Flags [P.], seq 1:70, ack 2, win 14600, length 69

Just to convince myself that the server was sending the hello packet, I modified the code to work on my Linux box using the sockets and saw the hello packets exactly as I expected.

Does anybody know what would cause this, if it has been seen before, and how to fix it?

I very much appreciate any help,
Buzz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]