CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

http.c in the tcp/ip examples.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

http.c in the tcp/ip examples.
PostPosted: Thu Dec 02, 2010 4:33 am     Reply with quote

Just to let you know, if you are using the CCS tcp/ip examples for a web server there is a bug if you try and use more than 1 socket.

The function tcp_http_put_file in http.c has a static var (status) which retains the value for the last socket. When using multiple sockets this can become incorrect for the current one.

An easy fix is to :-
Code:

   static enum
   {
      HTTP_PUT_FILE_INIT = 0,
      HTTP_PUT_FILE_CONTINUE,
      HTTP_PUT_FILE_CHUNK_END,
      HTTP_PUT_FILE_DONE
   } status[HTTP_NUM_SOCKETS];

and then change all references to static in the function to
Code:

      status[which] = HTTP_PUT_FILE_CONTINUE;
...
   if (status[which] == HTTP_PUT_FILE_CONTINUE)
...
            if (ec == TCP_PUT_CONST_EC_FINISH)
               status[which] = HTTP_PUT_FILE_CHUNK_END;
...
   if (status[which] == HTTP_PUT_FILE_CHUNK_END)
...
         status[which] = HTTP_PUT_FILE_DONE;

and
   return(status[which] == HTTP_PUT_FILE_DONE);

Hope this helps!

I am also implementing some changes to speed it up a bit. Not ready to release those though.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group