HTTP Webserver with SOCKETS


This issue probably applies to HTTP but someone may have experienced something similar when programming a web server with c++. So I give it a try here.

In a project I'm trying to send a file(mp4/video) in a http response. I'm sending all data at once for now and trying to figure out what's happening.

The problem I've encountered is that the browser(IE) SOMETIMES aborts/close connection after it sends the first request for a resource, which makes my send attempt invalid. It doesn't matter if I send() or recv() after the request, both returns error code: 10054.


This is the conversation. The second attempt works(all bytes are sent as you can see) and I can play the file in the browser.


Connection 1 accepted.

Connection: 1, Request nr: 1
GET /videofile.mp4 HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko
Accept: */*
Referer: http://localhost:27015/index.php
GetContentFeatures.DLNA.ORG: 1
Pragma: getIfoFileURI.dlna.org
Accept-Language: sv-SE
Accept-Encoding: gzip, deflate
Host: localhost:27015
Connection: Keep-Alive
Cache-Control: no-cache

Response:
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: video/mp4
Content-Length: 38722854

(Body)

Sent: -1
Connection closing with error: 10054


------------------------------------------------------------------------------------------


Connection 2 accepted.

Connection: 2, Request nr: 1
GET /videofile.mp4 HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko
Accept: */*
Referer: http://localhost:27015/index.php
GetContentFeatures.DLNA.ORG: 1
Pragma: getIfoFileURI.dlna.org
Accept-Language: sv-SE
Accept-Encoding: gzip, deflate
Host: localhost:27015
Connection: Keep-Alive
Cache-Control: no-cache


Response:
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: video/mp4
Content-Length: 38722854

(Body)

Sent: 38722948
Last edited on
It would help if you didn't use multiple posts while discussing a single problem.
Sure. I'll think about that. Now that you're here... Any thoughts?
Last edited on
10054 means the socket is closed.

The only method I can think of to try to work out why the connection was closed is to record the session (with Wireshark), but you'll need to learn a little more to understand what it records, and a little about Wireshark to get useful information from that.
Topic archived. No new replies allowed.