lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] netconn_recv issue


From: am85
Subject: [lwip-users] netconn_recv issue
Date: Wed, 25 Aug 2010 02:10:58 -0700 (PDT)

Hello,
 
Good day.
 
I'm using lwip-1.3.1 to implement a HTTP server with FreeRTOS.
I have created a server application, I read the request from the client
(Browser) and I send the html pages.
  
Browser send “Get / HTTP/1.1” , “GET /images1.gif” and “GET /images2.gif” :
I receive only the last GET.

Here is the code : 

void webserver(void *pvParameters)
{
  struct netconn *conn, *newconn;
        
  /* Create a connection structure */
  conn = netconn_new(NETCONN_TCP);
  
  /* bind the connection to http port : 80 */
  netconn_bind(conn, NULL, 80);
  
  /* tell the connection to listen for incoming connection requests */
  netconn_listen(conn);

  for ( ;;)
  {
    /* Wait for a first connection. */
    newconn = netconn_accept(conn);
    
    if( newconn != NULL )
    {
      
/* read received data. */
  Buffer = netconn_recv(RxConn);
    
  if( Buffer != NULL )
  {
    /* Get the data pointer and length of the data inside a Buffer */
    netbuf_data(Buffer, (void *) &dataptr, &len);
        
    if( dataptr != NULL )
    {
      data = dataptr;

      if( strncmp(data, "GET / ", 4 ) == 0 )
      {
        /* Send home page: text only */
        netconn_write( RxConn, (char *)(file.data), file.len, NETCONN_COPY
);
     } 

     else if( strncmp(data, "GET /image1.gif", 15 ) == 0 )
      {
        /* Send first picture */
        netconn_write( RxConn, (char *)(file.data), file.len, NETCONN_COPY
);
     } 

else if( strncmp(data, "GET /image2.gif", 15 ) == 0 )
      {
        /* Send second picture */
        netconn_write( RxConn, (char *)(file.data), file.len, NETCONN_COPY
);
     } 
   }
} 


The problem is, I receive three requests only the last GET command. The
succeeding GET requests ("GET / " and "GET /image1.gif",) are all failing.
Any idea on this one?
 
Thank you very much.

-- 
View this message in context: 
http://old.nabble.com/netconn_recv-issue-tp29529616p29529616.html
Sent from the lwip-users mailing list archive at Nabble.com.




reply via email to

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