Re: Socket recv() question?
- From: Vin <Vin@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 21 Feb 2007 10:43:08 -0800
Paul,
Thanks for the help. But please keep in mind that we are not all Microsoft
Certified (eMVP) and that we all not gurus like yourself. We are in the
learning curve, so most of the time we might ask stupid questions, but asking
questions is the best way to learn.
"Paul G. Tobey [eMVP]" wrote:
Huh? How many different ways are there for transferring a file via the.
network and writing it to a local file in the filesystem? That's pretty
much like saying, "How can my file code be wrong? I'm using WriteFile()."
You might be doing something crazy, writing the data to the file one byte at
a time or something. I can't predict, specifically, what you might be doing
wrong based on the simple statement that your code is slow! Yes, you might
be doing the wrong thing with recv() (again, we don't have your code, so
expecting us to debug it is crazy), but you might easily be doing something
else in the code that receives the data or writes it to the local file which
is responsible.
Paul T.
"Vin" <Vin@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5146C1F9-D9C9-4E5E-AC5F-9AC03B9DF29E@xxxxxxxxxxxxxxxx
Paul,
That makes a lot of sense. But how can I be at fault if I am using the
socket function correctly?
The PC would send the data and Pocket PC would receive it.
I am using recv() in a while loop until bytes received = 0.
I noticed that each time it looped, the received count is 32 kb. that's
all.
I guess I am using recv() in a wrong manner.
"Paul G. Tobey [eMVP]" wrote:
You're interpreting "downloading a file" as a single atomic operation.
It's
not even close! Use a packet sniffer and see just how many packets that
file is split into (if the sniffer will count that high!)
I can't tell you why your code is slow and IE is fast, but my guess would
be
you, not Windows CE, are at fault. Of course, there are dozens of
testing
errors that might pop up. IE already has the file in the cache, so
downloading it does nothing but copy it from the cache to another
location
in the filesystem, you're writing the file to flash-based media, while IE
is
writing it to RAM filesystem (much faster), etc., etc.
Paul T.
"Vin" <Vin@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:78506016-31AC-4378-826B-EE27B2956FCB@xxxxxxxxxxxxxxxx
Thanks Paul,
But here's a question for you.
How come when I use the IE on the Pocket PC and started IIS on my PC.
On
the Pocket PC I loaded a home page that would allow to download the
same
size
file (1.4 mb). When I click on the link and save the file to the pocket
PC,
it took only 5 seconds.
Now, why is that? what would be the difference between using http IIS
and
socket recv();
"Paul G. Tobey [eMVP]" wrote:
There's a limited amount of RAM in CE devices. You can't use virtual
memory
and RAM is limited. It's only going to return you a relatively small
amount. For that matter, I seriously doubt that the PC is sending
that
data
in a single packet, either. On the send end, the PC can buffer up a
huge
amount of data and send it in manageable pieces; you can't reasonably
do
that on the Pocket PC.
Paul T.
"Richard Plante" <richard.plante@xxxxxxxx> wrote in message
news:%23mHteCQVHHA.868@xxxxxxxxxxxxxxxxxxxxxxx
0) Assuming the following variables
SOCKET s;
timeval timeout;
1) First, create a descriptor
fd_set fd;
2) Initialize it
fd.fd_array[0] = s;
fd.fd_count = 1;
3) Configure tx timeout
select(0, NULL, &fd, NULL, &timeout);
4) Configure rx timeout
select(0, &fd, NULL, NULL, &timeout);
"Vin" <Vin@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:001E0DB9-956B-4E2A-B5D9-AB1F49C213DC@xxxxxxxxxxxxxxxx
Hi Thanks for the advice.
Yes I looked at the return code and it was normal. The most data
that
I
can
receive it 32kb that's all. Is there something I am doing wrong?
by the way, how do you use the select to change the time out? I
have
never
done it before. Can you send me more info on this or a code
snippet?
thanks
"Richard Plante" wrote:
Did you look at the return code when exiting your loop that omnly
retrieves
32Kb of data? It could be a timeout problem; in that case I would
consider
increasing the timeout using the select method on the socket
descriptor.
"Vin" <Vin@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1E552903-CD74-485D-8293-C117D7255E39@xxxxxxxxxxxxxxxx
Sorry, I am using Embedded visual c++ 4.0 ( NOT ce 3.0)
thanks
"Vin" wrote:
Hi,
I am developing an application using Embedded visual c++ (wince
3.0)
using
sockets to send binary data from a pc to Pocket PC.
The PC is set to send 1.4mb through the socket, but the Pocket
PC
is
only
receive 32kb at a time within the while loop
for example:
while(moreData)
{
moreData = recv(s, buf, len, 0);
}
OK, is there anything I can do to improve this 32kb of data on
the
socket?
Why so low? Is it possible to increase it from 32kb to at least
1mb?
I am trying to transfer some data at least 1.5 mb from the PC
to
the
PC.
Is there any other way to achieve this?
Please give me some ideas. Many thanks
- Follow-Ups:
- Re: Socket recv() question?
- From: Paul G. Tobey [eMVP]
- Re: Socket recv() question?
- References:
- Re: Socket recv() question?
- From: Richard Plante
- Re: Socket recv() question?
- From: Richard Plante
- Re: Socket recv() question?
- From: Paul G. Tobey [eMVP]
- Re: Socket recv() question?
- From: Vin
- Re: Socket recv() question?
- From: Paul G. Tobey [eMVP]
- Re: Socket recv() question?
- From: Vin
- Re: Socket recv() question?
- From: Paul G. Tobey [eMVP]
- Re: Socket recv() question?
- Prev by Date: Re: Problem with Registering filter on windows mobile
- Next by Date: Re: Socket recv() question?
- Previous by thread: Re: Socket recv() question?
- Next by thread: Re: Socket recv() question?
- Index(es):
Relevant Pages
|