Oh Come On !
I absolutely know i am a beginner....
I know the differences between 1.0 and 1.1
Maybe i should frame my q differently...
I have tried this code to set up socket reuse ,
when i change the condition set to 0 it gives an error otherwise works fine with -1
i am trying to set the socket option here.
and the way i am testing is i have a html with text and image .
so when i request it to my server its showing up as two connections rather than one, i want the .html to receive both text and image in one persistent connection.
Code:
if(setsockopt(newsockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(opt)) <= -1)
{
perror("FAIL on setsockopt, error:");
exit(-1);
}
The output on server side when requesting index.html ( getting two connections for a html file(index.html) if it has a image(winter.jpg)in it)
Code:
bash-2.05$
Incoming connection from <IP Address>
Comes from the child process so child working
GET /index.html HTTP/1.1
GET
/index.html
HTTP/1.1Host: <host>:<port#>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Incoming connection from <IP Address>
Comes from the child process so child working
GET /winter.jpg HTTP/1.1
GET
/winter.jpg
HTTP/1.1Host:<host>:<port #>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4
Accept: image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://<host>:<port#>/index.html
Thanks for the time...