sending "HTTP/1.0 200 OK \r\n" does not work in the browser(ie5.0)!

Hi,
   I am writing a proxy server with C using vc++ 6.0
   I am using WIN32 API and NOT USING MFC. My problem is
   sending the basic HTTP headers just does not work in
   the browser! I have included the code. Pleash HELP!

#include "main.h"    
void main()
{
     WSAData wData;
     SOCKET serverSocket;    
     SOCKADDR_IN serverAddr;

     WSAStartup(MAKEWORD(2, 0), &wData);

     serverSocket=socket(AF_INET, SOCK_STREAM, 0);

     serverAddr.sin_family=AF_INET;
     serverAddr.sin_port=htons(8080);
     serverAddr.sin_addr.s_addr=inet_addr("192.168.0.1");
     bind(serverSocket, (struct sockaddr *)&serverAddr, sizeof
                            (serverAddr));

     listen(serverSocket, 10);

     while(true)
     {
          SOCKADDR_IN clientAddr;
          int clientAddrLen=sizeof(clientAddr);

          SOCKET client=accept(serverSocket, (struct sockaddr *)      
                                     &clientAddr, &clientAddrLen);          
          char * resp="HTTP/1.0 200 OK\r\n"
                   "Content-type: text/html\r\n\r\n"
                   "<html>ASHOK</html>\r\n";

          send(client, resp, strlen(resp), 0);

          shutdown(client, 0x2);          
          closesocket(client);
     }

     WSACleanup();
}

kashokshenoyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cmaryusCommented:
you MUST call receive first.
when connecting to a server the browser send a request, then it reads for the answer from the server.
so after accept, do :
char szRecvbuf[2049];
recv(client, szRecvbuf, 2048, 0);
then you can send the buffer
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kashokshenoyAuthor Commented:
Thanks for the timely help.

You saved my scalp!!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.