Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3932982
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:33:00+00:00 2026-05-19T23:33:00+00:00

I wrote a simple server using socket API in C under linux which listens

  • 0

I wrote a simple server using socket API in C under linux which listens at port 80 on localhost. Now when I send a request from the browser google chrome to the program it receives 2 requests while it receives only one when I send from firefox.

The URL I typed in the browser was: http://localhost/xyz.html

OUTPUT WHEN I TYPE URL IN CHROME

root@anirudh-Aspire-5920:/home/anirudh/workspace/DCMTOL# ./DCMTOL_RUN 

Inside HTTP server Handler

Inside HTTP request Handler 

**Detected request: clientsocket_fd = 6 clientportnumber = 38027**

GET /xyz.html HTTP/1.1

Host: localhost

Connection: keep-alive

Cache-Control: max-age=0

Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10

Accept-Encoding: gzip,deflate,sdch

Accept-Language: en-US,en;q=0.8

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3


Inside HTTP request Handler

**Detected request: clientsocket_fd = 7 clientportnumber = 38029**

^C

root@anirudh-Aspire-5920:/home/anirudh/workspace/DCMTOL# 

the second request does not send any data so my code waits at the read call and so I have to terminate it ‘^C’.

OUTPUT WHEN I TYPE URL IN FIREFOX

root@anirudh-Aspire-5920:/home/anirudh/workspace/DCMTOL# ./DCMTOL_RUN 
Inside HTTP server Handler
Inside HTTP request Handler

**Detected request: clientsocket_fd = 6 clientportnumber = 45567**

GET /xyz.html HTTP/1.1

Host: localhost

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

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: 115

Connection: keep-alive


^C

root@anirudh-Aspire-5920:/home/anirudh/workspace/DCMTOL# 

Question: How can chrome browser send 2 requests (one being empty) when I typed the URL only once. As you can see above I detected 2 requests. I tried to do netstat in the case of sending URL from chrome and I found that both of the request were sent by the browser only. and as u can see above when I send the URL from firefox only 1 request is received.

Here is the output of net stat when I send request from chrome

Active Internet connections (w/o servers)

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

tcp        0      0 117.195.110.186:48701   74.125.77.102:80        TIME_WAIT   -

tcp        0      0 117.195.110.186:48700   74.125.77.102:80        ESTABLISHED 5699/google-chrome

tcp        0      0 117.195.110.186:55815   209.85.175.138:80       ESTABLISHED 5699/google-chrome

tcp        0      0 127.0.0.1:80            127.0.0.1:38029         ESTABLISHED -

tcp        0      0 127.0.0.1:38029         127.0.0.1:80            ESTABLISHED 5699/google-chrome

tcp        0      0 127.0.0.1:38027         127.0.0.1:80            ESTABLISHED 5699/google-chrome

tcp        0      0 127.0.0.1:80            127.0.0.1:38027         ESTABLISHED -

tcp        0      0 117.195.110.186:35402   74.125.153.125:5222     ESTABLISHED 4430/pidgin

thanks in advance 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T23:33:01+00:00Added an answer on May 19, 2026 at 11:33 pm

    I had a similar issue with my node server. It is due to the following bug in Chrome. In summary, Chrome is sending a request for a favicon on every request. As, is likely, you aren’t sending a favicon back, it requests one after every legitimate request.

    Firefox, and most other browsers, also send out a request for a favicon when they first connect, but cache the result i.e. if there isn’t a favicon returned first time, they don’t keep trying – which is why you’re only seeing a single request from Firefox. It seems Chrome is unfortunately a little too persistent with its favicon requestiness.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a simple web service in C# using SharpDevelop (which I just got
It's a simple client-server where Server using a BufferedWriter object would send to the
I wrote a simple tool to generate a DBUnit XML dataset using queries that
I wrote a simple javascript image rotator which picks a random image on each
I have a simple Google App Engine app, that I wrote using ordinary strings.
I am trying to Create a simple Tcp Server in C++ using Boost ASio
I have two simple programmes, server and client, both at localhost. What I want
I try to write a simple client/server application (all application is a bluetooth service
I wrote a simple batch file as a PowerShell script, and I am getting
I wrote a simple Windows Forms program in C#. I want to be able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.