lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] tcp checksum error after the first frame.


From: Muhamad Ikhwan Ismail
Subject: [lwip-users] tcp checksum error after the first frame.
Date: Fri, 18 Jan 2008 10:43:01 +0000


Hi,

Yup its me again and the same problem but this time it involves TCP.

I have a weird case here :

1. Client (lwip socket) sends a SYN
2.The echo server (Java server running on Windows PC) sends back SYN+ACK, checksum OK
3.Client sends a ACK.Sends some dummy data.
4.Server ACKs but with checksum error. And the server didnt echo back the dummy data.

Actually it happens each time after the endhost (not lwip) sent more than 1 frame. The first frame checksum are always
OK, but the next ones have error. And if I connect the PC to another client (not running the lwip stack), everything turns out fine.
I have a sample of the Wireshark trace and my client program here. I dont think the Java echo server is the problem, nor the Windows stack.
I kinda stumped right now.

Thanks a lot in advance
Ikhwan

void test_tcp_socket (void)
{
    /*first get a stream socket*/
    int socket_index;
    socket_index = socket(AF_INET,SOCK_STREAM,0x00);
   
    /*now get a sockaddr structure corresponding to socket domain AF_INET */
    struct sockaddr_in* endpoint = (struct sockaddr_in*)mallocx(sizeof(struct sockaddr));   
    (endpoint)->sin_family = AF_INET;
    (endpoint)->sin_port = (htons(1234));
    struct ip_addr server_ip;
    IP4_ADDR(&server_ip,169,254,36,145);
    (endpoint)->sin_addr.s_addr = server_ip.addr;
    //(endpoint)->sin_addr.s_addr = (htonl(0xA9FE2491));
    int addrlen = (endpoint)->sin_len = sizeof((endpoint)->sin_addr.s_addr);
   
    if(socket_index == -1){
        return;
    }
   
    /*attempt to connect to the remote server*/
    short error_check = connect(socket_index, (struct sockaddr*)endpoint,addrlen);
   
    SCB_PTR suspend_me;    //semaphore used to suspend the thread
    suspend_me = create_sema(1);
    /*required otherwise ACK sent too late,and corrupts the connection*/
    WaitForSingleObject(suspend_me,SMX_MSEC_TO_TICKS(300));       
   
           
   
    /*allocate some dummy_data of 20 bytes*/
    char* test_data = (char*)mallocx(20);
    test_data[0] = 'G';
    test_data[1] = 'E';
    test_data[2] = 'T';
    for(int i =3 ; i<20;i++)
        test_data[i]= '2';

   
    /*now send the data and check for error and resend*/
    while(1){
        error_check = write(socket_index, (void*)test_data,20);
        WaitForSingleObject(suspend_me,SMX_MSEC_TO_TICKS(30));
    }   
    /*finished sending now close the connection*/
    error_check = close(socket_index);
   
    /*delete all connection variables*/
    freex(endpoint);
    return;   
}


Shed those extra pounds with MSN and The Biggest Loser!! Learn more.

Attachment: tcp_checksum_error.pcap
Description: Binary data


reply via email to

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