WebRequest/WebResponse Pluggable Protocol Question

J

Jacob

I hope this is the right group for this. I'm trying to write an Nntp class
library that derives from WebRequest and WebResponse. I want to use
WebRequest and WebResponse because it is the model setup in the framework
for generic Internet communication and I want to stick to its benefits of
being protocol-agnostic when implemented correctly.

Question: The WebRequest provides a Method property used to set the command
verb being sent to the remote server, but where can I put other attributes
necessary to most Nntp commands?
For example: the Nntp command XOVER requires a 'range' attribute. XOVER
would be the Method property, but what about the attribute information?

Should I create some sort of attribute collection (like unto the Header
collection) or an attribute property? But then some commands require two
attributes, some ints, some strings? It would be crazy to try and create
properties for every command option and combination. I just don't feel like
this is the correct way to do that. Ideally all commands should be able to
be executed with only setting the Method property verb to make sure that
classes derived from WebRequest can be cast back to a WebRequest and that
the commands can be protocol independent.

If anybody knows what I'm talking about... any direction from anyone would
be helpful.

Thanks,
Jacob
 
J

Joerg Jooss

Jacob said:
I hope this is the right group for this. I'm trying to write an Nntp
class library that derives from WebRequest and WebResponse. I want
to use WebRequest and WebResponse because it is the model setup in
the framework for generic Internet communication and I want to stick
to its benefits of being protocol-agnostic when implemented correctly.

Question: The WebRequest provides a Method property used to set the
command verb being sent to the remote server, but where can I put
other attributes necessary to most Nntp commands?
For example: the Nntp command XOVER requires a 'range' attribute.
XOVER would be the Method property, but what about the attribute
information?

Should I create some sort of attribute collection (like unto the
Header collection) or an attribute property? But then some commands
require two attributes, some ints, some strings? It would be crazy
to try and create properties for every command option and
combination. I just don't feel like this is the correct way to do
that. Ideally all commands should be able to be executed with only
setting the Method property verb to make sure that classes derived
from WebRequest can be cast back to a WebRequest and that the
commands can be protocol independent.

If anybody knows what I'm talking about... any direction from anyone
would be helpful.


What about creating a NntpCommandFactory class, that is able to build the
desired NNTP methods (i.e. strings)? Thus, you could only create valid
commands provided you're using the factory.

Cheers,
 
J

Jacob

Not a bad idea... actually one that I had considered already. My concern
isn't so much that people will build bad commands, as it is more that I just
want to do things the correct way and using the supplied .Net protocol. I
could just write my own homebrewed nntp class library (which I've done by
the way), but my goal of this project is conformance to the protocol.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top