lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] [lwip] tcp_slowtmr


From: Rajeev
Subject: [lwip-users] [lwip] tcp_slowtmr
Date: Thu, 09 Jan 2003 01:59:19 -0000

This is a multi-part message in MIME format.

------=_NextPart_000_001B_01C1AB22.E252CEC0
Content-Type: multipart/alternative;
        boundary="----=_NextPart_001_001C_01C1AB22.E252CEC0"


------=_NextPart_001_001C_01C1AB22.E252CEC0
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

hi ,
  i'm using the lwip stack on DOS. i'm still in the process of =
understanding and analysing the whole stack(newbie!).
    i tried checking the stack with a simple application
( main.c and debug.log attached)
  i call the tcp_slowtmr every 500 ms in the timer ISR. i have =
implemented semaphores to prevent nesting of interrupts.
  i'm not able to comprehend the strange logging of the debug messages =
in the debug.log file. the characters are being overwritten and some =
characs are missing.
  can anybody throw some light on this.

thanks
rajeev

------=_NextPart_001_001C_01C1AB22.E252CEC0
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2919.6307" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#c0c0c0>
<DIV><FONT face=3DArial size=3D2>hi ,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; i'm using the lwip stack on DOS. =
i'm still=20
in the process of understanding and analysing the whole=20
stack(newbie!).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; i tried checking the =
stack with=20
a simple application</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>( main.c and debug.log =
attached)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; i call the tcp_slowtmr every 500 =
ms in the=20
timer ISR. i have implemented semaphores to prevent nesting of=20
interrupts.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; i'm not able to comprehend the =
strange=20
logging of the debug messages in the debug.log file. the characters are =
being=20
overwritten and some characs are missing.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; can anybody throw some light on=20
this.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>rajeev</FONT></DIV></BODY></HTML>

------=_NextPart_001_001C_01C1AB22.E252CEC0--

------=_NextPart_000_001B_01C1AB22.E252CEC0
Content-Type: application/octet-stream;
        name="DEBUG.LOG"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
        filename="DEBUG.LOG"

tcp_bind: bind to port 19
tcp_connect to port 19
TCP_REG 1F50 local port 4097
TCP header:
+-------------------------------+
|      1001     |      0019     | (src port, dest port)
+-------------------------------+
|            1830354944           | (seq no)
+-------------------------------+
|            00000000           | (ack no)
+-------------------------------+
|  0 |    |00000|        0      | (offset, flags (), win)
+-------------------------------+
|    0x0000     |         0     | (chksum, urgp)
+-------------------------------+
tcp_enqueue: queueing 6509:6510 (0x2)
tcp_output: snd_wnd 1024, cwnd 65537, wnd 65536, effwnd 426573824, seq =
426573824, ack 525336576
tcp_output: snd_wnd 1024, cwnd 65537, wnd 65536, effwnd 426573824, seq =
426573824, ack 0, i1f50
tcp_output_segment: rtseq 6509
tcp_output_segment: 6509:6510
ip_output_if: =00=00 IP header:
+-------------------------------+
| 4 | 5 |    0  |        2c     | (v, hl, tos, len)
+-------------------------------+
|        1      |000|       0   | (id, flags, offset)
+-------------------------------+
|   ff  |    6  |    0x1b2b     | (ttl, proto, chksum)
+-------------------------------+
|   20  |   20  |   20  |   20  | (src)
+-------------------------------+
|   30  |   30  |   30  |   30  | (dest)
+-------------------------------+
g in state =00
=00tcp_abort: scp_close: =
address@hidden@=01=10n=19=00=00tcp_close: closing in =
state=06 @@@@@@@=01=10n=19=00=00tcp_close: closing in state =00
=00tcp_abort: sending RST
=00tcp_bind: =06 @@@@@=01=10n=19=00=00tcp_close: closing in =
state=04=08=06 @@@@@@@=01=10n=19=00=00tcp_close: closing in state =00
=00tcp_abort: sending RST
=00tcp_bind=04=08=06 =
@@@@@@@=01=10n=19=00=00tcp_close:@=01=10n=19=00=00tcp_close: closing in =
state@@@@@@@=01=10n=19=00=00tcp_close: closing in state =00
=00tcp_abort: sending RST
address@hidden: closing in state
=00=04=00=01=02=04=08=06 @@@@@@@=01=10n=19=00=00tcp_close: closing in =
state =00
=00tcp_abort: sending RST
=00tc
=00=04=00=01=02=04=08=06 =
@@@@@@@address@hidden: closing in state
=00=04=00=01=02=04=08=06 @@@@@@@=01=10n=19=00=00tcp_close: closing in =
state =00
=00tcp_abort: sending RST
=00tc
=00=04=00=01=02=04=08=06 =
@@@@@@@address@hidden: closing in =
statecalled tcp_slowtmr 6 , global count 1
------=_NextPart_000_001B_01C1AB22.E252CEC0
Content-Type: application/octet-stream;
        name="MAIN.C"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
        filename="MAIN.C"

# include "tcp.h"
# include "debug.h"
# include "err.h"
# include "netif.h"
# include "sys.h"
# include <dos.h>

# define TMR_INTR       0x1c

err_t connected (void *, struct tcp_pcb *, err_t);
void init(struct netif*);
err_t input(struct pbuf*, struct netif*);
void network_init(struct netif *);
void send (struct netif*, struct pbuf *, struct ip_addr*);
extern void interrupt (*oldtimer) (void);
extern void interrupt timer_handler(void);
extern int count;

/*Global file descriptor for debug log*/

FILE *fp, *fp1;
my_sem_t * sem;
extern int c;

int main(void) {
        struct tcp_pcb *pcb, *tpcb;
        struct ip_addr host_ip_addr, dest_ip_addr;
        struct ip_addr  *netmask;
        struct netif * netif;
        u16_t host_port, dest_port;
        err_t err, terr;
        void * arg;
        char dataptr[25] = "hellohihellohihellohi";
        unsigned long int i = 0;
        int j;
        clrscr();
  //    disable();
        debug_init();
        sem = my_sem_init(sem);
        if(sem == NULL){
                DEBUGF(MYSEMDEBUG,(fp,"semaphore mem alloc failed\n"));
                return;
        }

        host_ip_addr.addr = 0x20202020;
        dest_ip_addr.addr = 0x30303030;
        host_port = 25;
        dest_port = 25;

        mem_init ();
        memp_init ();
        tcp_init ();
        pcb = tcp_new ();
        oldtimer = getvect( TMR_INTR );
        setvect(TMR_INTR, timer_handler);

        if(pcb == NULL) {
                DEBUGF(APP_DEBUG, (fp,"Mem not available for tcp_new \n"));
                return -1;
        }
        netif = netif_add(&host_ip_addr, netmask, NULL, init, input);
        if(netif == NULL)
                DEBUGF(APP_DEBUG, (fp,"netif not available  \n"));
        network_init(netif);
        err = tcp_bind (pcb, &host_ip_addr, host_port);
        if (err != ERR_OK) {
                DEBUGF(APP_DEBUG, (fp,"tcp_bind failed \n"));
                return -1;
        }

        err = tcp_connect (pcb, &dest_ip_addr, dest_port, connected);
                if (err != ERR_OK) {
                        DEBUGF(APP_DEBUG, (fp,"tcp_connect failed \n"));
                }

        for(i=0; i<0xffffff;i++);
        for(i=0; i<0xffffff;i++);
        for(i=0; i<0xffffff;i++);
        for(i=0; i<0xffffff;i++);
        for(i=0; i<0xffffff;i++);
        for(i=0; i<0xffffff;i++);
        for(i=0; i<0xffffff;i++);

        printf("maga maga maga\n");

        fprintf(fp, "called tcp_slowtmr %d , global count %d", c, count);
        fflush(fp);
        fflush(fp1);
        fclose(fp);

        while (!kbhit());
//      while (1);
        setvect(TMR_INTR, oldtimer);
        free(sem);
        return 0;
}
err_t connected (void * arg, struct tcp_pcb *tpcb, err_t terr) {

}

void  init(struct netif * netif) {

}

int debug_init(void) {
        fp = fopen( "c:\\lwproj\\debug.log", "w");
        if ( fp == NULL ) {
                printf("could not open log file\n");
                return;
        }
        fp1 = fopen("c:\\lwproj\\ibug.log", "wb");
        if ( fp1 == NULL ) {
                printf("could not open log file\n");
                return;
        }
}

err_t input(struct pbuf *pbuf, struct netif * netif) {

}

void network_init(struct netif * netif) {
        netif->output = send;
}

void send(struct netif * netif, struct pbuf *p, struct ip_addr *dest) {  }
#if 0
        char data[400];
        char *t;
        short int count = 0;
        t = p->payload;
        while (count < 44) {
                data[count] = *t++;
                count++;
        }
        data[count] = 0;
        printf("Sending packets\n");
        printf("Destination address %Ld\n", dest->addr);
//      for(count = 0; count < 44; count++)
//              printf("data %c", data[count]);
        printf("Length :%d \t Total length :%d\n", p->len, p->tot_len);
        getch();

}
#endif

------=_NextPart_000_001B_01C1AB22.E252CEC0--


[This message was sent through the lwip discussion list.]




reply via email to

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