Managing Bandwidth with C#

  • Thread starter Thread starter Chibi
  • Start date Start date
C

Chibi

I'm writing an application that's bandwidth intense.

My available bandwidth is 1.5Mbps (cable modem) and I know
I can reach around 1.4Mbps, if not more.

The application I am writing right now simply connects to a
newsgroup and downloads the headers. It doesn't do any more
specific programmming after that. However, the app will
use, at most, 100kbps bandwidth. I'm hoping that it can run
much faster than that and reach somewhere close to the 1.
4Mbps maximum.

Is there any way I can use C# to increase this bandwidth
aside from multi-threading and connecting multiple times to
the news server? I hope so... I welcome any input.

Thank you.
 
Chibi,

If there is such an option, then you will probably have to set the
individual socket properties (however, I don't know of any offhand,
otherwise, I would have offered it).

Also, you are limited by the bandwidth on the other end as well. Do you
know that the NNTP server on the other end can support that throughput?

Hope this helps.
 
Nicholas,

Thanks for your reply.

As for the other end, using a newsreader, I can constantly
reach 1.4Mbps. I tested both applications (the one I'm
writing and the one I'm currently using) side by side and
the current newsreader never has any speed issues. Of
course, I'm not running both simultaneously.

I will have to look into socket properties now. At least
you got me thinking a bit.

I appreciate your help and hope you or anyone else reading
this can help me find a good solution.

Thank you!

-----Original Message-----
Chibi,

If there is such an option, then you will probably have to set the
individual socket properties (however, I don't know of any offhand,
otherwise, I would have offered it).

Also, you are limited by the bandwidth on the other end as well. Do you
know that the NNTP server on the other end can support that throughput?

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

I'm writing an application that's bandwidth intense.

My available bandwidth is 1.5Mbps (cable modem) and I know
I can reach around 1.4Mbps, if not more.

The application I am writing right now simply connects to a
newsgroup and downloads the headers. It doesn't do any more
specific programmming after that. However, the app will
use, at most, 100kbps bandwidth. I'm hoping that it can run
much faster than that and reach somewhere close to the 1.
4Mbps maximum.

Is there any way I can use C# to increase this bandwidth
aside from multi-threading and connecting multiple times to
the news server? I hope so... I welcome any input.

Thank you.


.
 
Hi Chibi,

IIRC a TCP connection speed is dependand of several factors, in general
it's as fast as the bandwith allow, creating more connection will not help
the speed of the first, al least of course that you have some bandwidth
control system in place.

I'm also curious of how you calculate the bandwidth of both the
applications.

Cheers,
 
Ignacio,

My calculation is not very scientific. Basically, I'm
using both applications to download only headers from the
same newsgroup and news server. With the application I've
written, I've calculated 100 headers in about 30 seconds.
With the commercial application, 100 headers download at
about 2-3 seconds.

Also, it is possible to measure ballpark figures by
calculating number of lines in each header and multiply it
by average number of characters per line.

Obviously, I didn't use a calculator to calculate exact
figures but by the measurements I pointed out above,
there's a huge difference in speed in what I wrote and
what the other application can do. I would like to know
how I can get figures closer to those of the commercial
application.

Any suggestions would be kindly welcomed.

Thank you.
 
HI Chibi,
My calculation is not very scientific. Basically, I'm
using both applications to download only headers from the
same newsgroup and news server. With the application I've
written, I've calculated 100 headers in about 30 seconds.
With the commercial application, 100 headers download at
about 2-3 seconds.

Are you running your application from the debugger?
If so I will suggest you to compile it to release and run it from the
prompt.


Cheers,
 
Chibi,

10 bucks says that you're using the NNTP HEAD command to retrieve the
headers individually instead of using the NNTP XOVER command (which is what
every other respectable newsgroup software is doing).

If you ever want to find out what commands your news software is using, try
a packet sniffer to monitor your TCP communications.
http://www.prism.gatech.edu/~gte477n/languages/csharp/

Hope this helps,
Jacob
 
Also, reuse open connections when possible. TCP takes a bit to get to
the max capacity of the line. If your code makes many connections and
then closes them, the speed won't/can't increase. Agent, my
newswreader, usually keeps a connection to server open for 5 minutes,
allowing efficient retrieval of headers/messages.

Increase the # of headers you download, and you should come close to
maxing out.

Austin
 
Jacob,

Thank you very much for your feedback.

Both of your suggestions have turned out to be very
helpful in my case. If I could send you a $10 bill via
newsgroups, I would. I was using the HEAD command to
retrieve headers. I read an (apparently outdated) RFC on
the NNTP protocol and did not run across the XOVER
command. I'm glad you mentioned it to me.

The NetSniffer also retrieved information that really
helped me understand my problem. It's a very handy utility.

Now, I'm going to go back and study more on the XOVER
command and figure out how to parse the data sent back.

I appreciate your help and from all those others who gave
me information to think about.

Thank you and take care!
 
At one point I had to find out the same thing. The original NNTP protocol
doesn't include the XOVER command. It's part of the NNTP extensions (RFC
2980). You'll find that virtually every server supports this command, but
it would be wise to still develop a method using the HEAD command just in
case your client's server doesn't. To make the most of the XOVER command,
do some research on the LIST OVERVIEW.FMT command. It will return a list of
all the fields of information that you can expect to receive from the XOVER
command. That what you know what your client's server will be sending and
how to parse it. The XOVER command should return all those fields separated
by tabs, so it should be easy to split the field information on the tabs.

I've been writing a NNTP program for some time, but because of work
restraints, I don't know if I'll ever be able to finish it. But I would be
happy to help you out form time to time with the things I learned along the
way. Keep me apprised of your progress.

(e-mail address removed)
Jacob
 
Back
Top