The code uses a buffer of 256 bytes, which is often too small to store both the HTTP header and the actual HTML page. You should either user a larger buffer or read multiple times from the socket.
Edit
I think replacing the last few lines of the code (after the last write) by
do
{
bzero(buffer,256);
n = read(sockfd,buffer,255);
if (n < 0)
error("ERROR reading from socket");
printf("%s",buffer);
} while (n > 0);
printf("\n");
will do the trick.