Networking Forums

Networking Forums > Computer Networking > Linux Networking > socket call does not read full content

Reply
Thread Tools Display Modes

socket call does not read full content

 
 
jainarunk@gmail.com
Guest
Posts: n/a

 
      07-18-2006, 03:27 PM
Hello Group,

I am implementing a http client and reading the content from the
socket. For MIME type

text/html the socket reads the full Content-Length bytes, however if
the MIME type is
audio/mpeg the socket does not read the whole Content-Length and only
reads some number
of less bytes from the web server.

It causes my program to go in an infinite loop, because I close the
socket when I read full
Content-Length.

Could someone tell me what could be causing this. I tried to debug it
in many ways but
could not come up with a reason.

Need help in figuring out the cause.

Thanks in advance.

nagrik

 
Reply With Quote
 
 
 
 
Allen McIntosh
Guest
Posts: n/a

 
      07-18-2006, 03:37 PM
(E-Mail Removed) wrote:
> I am implementing a http client and reading the content from the
> socket. For MIME type
>
> text/html the socket reads the full Content-Length bytes,


You were lucky. You will get however many bytes are available at the
time of the read. If the content is split over several frames, you may
not get everything in a single call.
 
Reply With Quote
 
jainarunk@gmail.com
Guest
Posts: n/a

 
      07-18-2006, 04:09 PM

Allen McIntosh wrote:
> (E-Mail Removed) wrote:
> > I am implementing a http client and reading the content from the
> > socket. For MIME type
> >
> > text/html the socket reads the full Content-Length bytes,

>
> You were lucky. You will get however many bytes are available at the
> time of the read. If the content is split over several frames, you may
> not get everything in a single call.


Allen,

I am making several calls, till I count all bytes and total is equal to
Content-Length.
However after reading some 21 bytes less, the client does not have
anything to read
although expecting 21 more bytes and thus the client goes in an
infinite loop.

nagrik

 
Reply With Quote
 
Davide DG
Guest
Posts: n/a

 
      07-18-2006, 06:57 PM
(E-Mail Removed) ha scritto:
> I am making several calls, till I count all bytes and total is equal to
> Content-Length.
> However after reading some 21 bytes less, the client does not have
> anything to read
> although expecting 21 more bytes and thus the client goes in an
> infinite loop.


I'd suggest using a packet sniffer (eg: ethereal).
bye.

--
Davide DG.
tieni per te la spam per rispondermi via email.
 
Reply With Quote
 
Spoon
Guest
Posts: n/a

 
      07-19-2006, 07:55 PM
Davide DG wrote:

> I'd suggest using a packet sniffer (eg: ethereal).


Ethereal is dead ;-)
 
Reply With Quote
 
Poly-poly man
Guest
Posts: n/a

 
      07-20-2006, 01:14 AM
Spoon wrote:
> Davide DG wrote:
>
>> I'd suggest using a packet sniffer (eg: ethereal).

>
> Ethereal is dead ;-)


I use ethereal, therefore I am dead?

Hey, wait a minute!

poly-p man
 
Reply With Quote
 
Davide DG
Guest
Posts: n/a

 
      07-22-2006, 10:53 PM
Spoon ha scritto:

> Ethereal is dead ;-)


lol, true!
http://www.wireshark.org/
thx for the post
bye.

--
Davide DG.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
linux c socket read html problem step Linux Networking 2 06-13-2007 11:59 AM
socket read modifies third parameter after the call: Very strange jainarunk@gmail.com Linux Networking 1 07-20-2006 09:15 PM
ioctl() call with a raw socket??? john.chludzinski@gmail.com Linux Networking 0 03-28-2006 11:11 PM
simultaneous read & write on socket fd Dirk Petera Linux Networking 0 09-15-2003 12:52 PM
Full duplex socket communication jahurt@hotmail.com Linux Networking 3 07-10-2003 03:19 AM



1 2 3 4 5 6 7 8 9 10 11