 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Ben Guest
|
Posted: Sat Sep 11, 2004 1:32 am Post subject: Socket Client recieving Multiple Packets |
|
|
Hello all,
I've got a fairly specific problem, and I'm hoping that somebody will
have had to do something similar in the past and can help me out.
I'm trying to write a client for a socket program in c++ to be
compiled and run on UNIX. To test it out, I have been trying to
connect to various webpages and simply print the html code to the
screen. The problem that I'm running into is that I'm butting up
against the maximum number of bytes that can be crammed into a packet.
That's to say... some of the webpages that I try to look at are too
large to fit into one packet.
Is there a way to recieve multiple packets from a server? To this
point, I have been able to connect to the server, send the request,
and do a 'recv()'. Is there a way to recieve more than one packet?
Thank you very much,
Ben
|
|
| Back to top |
|
 |
Jack Klein Guest
|
Posted: Sat Sep 11, 2004 3:31 am Post subject: Re: Socket Client recieving Multiple Packets |
|
|
On 10 Sep 2004 18:32:39 -0700, [email]bwilde (AT) gmail (DOT) com[/email] (Ben) wrote in
comp.lang.c++:
| Quote: | Hello all,
I've got a fairly specific problem, and I'm hoping that somebody will
have had to do something similar in the past and can help me out.
I'm trying to write a client for a socket program in c++ to be
compiled and run on UNIX. To test it out, I have been trying to
connect to various webpages and simply print the html code to the
screen. The problem that I'm running into is that I'm butting up
against the maximum number of bytes that can be crammed into a packet.
That's to say... some of the webpages that I try to look at are too
large to fit into one packet.
Is there a way to recieve multiple packets from a server? To this
point, I have been able to connect to the server, send the request,
and do a 'recv()'. Is there a way to recieve more than one packet?
Thank you very much,
Ben
|
The C++ language has no sockets, no support for networking at all in
fact. All such features are platform-specific extensions, not a part
of the language.
You need to take this to news:comp.unix.programmer, but read their
socket FAQ first.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
|
|
| Back to top |
|
 |
Karl Zimmerman Guest
|
Posted: Mon Sep 27, 2004 7:08 am Post subject: Re: Socket Client recieving Multiple Packets |
|
|
In article <dae9916a.0409101732.145ea35a (AT) posting (DOT) google.com>,
[email]bwilde (AT) gmail (DOT) com[/email] (Ben) wrote:
| Quote: | I'm trying to write a client for a socket program in c++ to be
compiled and run on UNIX. To test it out, I have been trying to
connect to various webpages and simply print the html code to the
screen. The problem that I'm running into is that I'm butting up
against the maximum number of bytes that can be crammed into a packet.
That's to say... some of the webpages that I try to look at are too
large to fit into one packet.
Is there a way to recieve multiple packets from a server? To this
point, I have been able to connect to the server, send the request,
and do a 'recv()'. Is there a way to recieve more than one packet?
|
Jack is right, this is a platform-related question; but the short answer
is "yes; do multiple calls to 'recv()' (or 'read()')". Note that
different session-layer protocols (like HTTP) have different rules on
how to tell you have read all of the data you can expect; you'll have to
read the HTTP RFC in order to get full details, but a short-short answer
is, you're done when
(a) the connection closes (recv/read will fail), or
(b) you've read the number of bytes indicated in the Content-Length:
header, or
(c) you've read the last "chunk" of a chunk-encoded page.
-- Karl
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|