curl-library
RE: Re: so is it possible to reference(aka include) libcurlintovb.net or what?
Date: Wed, 18 Aug 2004 14:54:49 -0400
I don't really understand why you don't want to use winInet. It's built
in, it's easy to use, and you have it for free. Wrapping a c library in
COM for VB to use is actually a pain to do.
The syntax for downloading something using wininet in c# is something
like the following: it's got to be pretty similar in vb
bool bTryWithProxy = true ;
bool bTryingWithProxy = true ;
bool bAllDone = false ;
Uri uriOut = null;
UriResult resultUri = null;
while ( !bAllDone )
{
WebResponse result = null ;
HttpWebRequest req = null ;
try
{
req =
(HttpWebRequest)WebRequest.Create ( uri ) ;
}
catch(Exception e)
{
Trace.WriteLine ( e.Message ) ;
throw ;
}
try
{
if(cookies == null)
cookies = new
CookieContainer();
req.CookieContainer = cookies;
bTryingWithProxy =
bTryWithProxy ;
bTryWithProxy = false
;
bAllDone
= !bTryingWithProxy ; // If not trying with proxy we have nothing else
to try
//req.MaximumAutomaticRedirections=1;
req.AllowAutoRedirect=true;
req.KeepAlive=true;
req.MaximumAutomaticRedirections=5;
req.Accept = "*/*" ;
req.Headers["Accept-Language"] =
"en-us" ;
req.UserAgent = "Mozilla/4.0
(compatible; MSIE 6.0; Windows NT 5.1)" ;
req.Timeout = iTimeoutMS ;
if ( bTryingWithProxy )
req.Proxy = new WebProxy
( "http://localhost:80/",true,new string[] { "www.*.*" } ) ;
result = req.GetResponse() ;
uriOut = result.ResponseUri;
// If we make it here, we've
passed the Proxy Good/Bad test...
bAllDone = true ;
Stream ReceiveStream =
result.GetResponseStream() ;
StreamReader sr = new
StreamReader ( ReceiveStream, System.Text.Encoding.GetEncoding("utf-8")
) ;
if ( sr != null )
{
string sBody =
sr.ReadToEnd();
sBody = sBody.ToLower();
resultUri = new
UriResult(uriOut, sBody);
}
}
-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Alex
Sent: Wednesday, August 18, 2004 2:36 PM
To: libcurl development
Subject: Re: Re: so is it possible to reference(aka include)
libcurlintovb.net or what?
----- Original Message -----
From: "Casey ODonnell" <caseyodonnell_at_gmail.com>
To: "libcurl development" <curl-library_at_cool.haxx.se>
Sent: Wednesday, August 18, 2004 9:57 AM
Subject: Re: Re: so is it possible to reference(aka include) libcurl
intovb.net or what?
> Two quick comments...
>
> 1.) Ask your question to VB.NET without really saying, "I'm using
> libcurl." Try, "I have this DLL with X and Y exported functions. How
> do I call them from VB.NET?" You may be in for one heck of a time, as
> you'll need "C" functions for your callbacks, and on Windows using a
> DLL, you MUST you call-backs for writing files...
>
> 2.) Compiling libcurl though not trivial (I'm guessing) would be a
> matter of changing the make file ("Makefile.vc6") for VS.NET. It may
> work as is...who knows. Give it a shot. Once I get back from my
> confereence abroad, I may look into making a Makefile.vc7...
>
> Longer comment...
>
> What I would suggest you do is think about a wrapper for libcurl
> (another DLL) that you or someone else would have to write with C/C++.
> Have that DLL provide some exported functions (or classes) that VB is
> actually capable of using well. You're sort of talking about apples
> and oranges here. libcurl is a C library, it uses C conventions, and
> expects you to at least be able to conform to those conventions.
> VB.NET is not only an interpreted language (yes, I know it 'compiles'
> ...but that is another issue entirely), but a language thatt has no
> real mechanism for ensuring that your code complies to C conventions.
> libcurl's whole premise of wrapping the hard stuff and leaving the
> easy details (reading/writing/setting options) for us just doesn't fit
> the VB model.
>
> Good luck.
>
> CKO
>
> On Wed, 18 Aug 2004 08:45:19 -0400, Alex
<windeagle_at_devilsplayground.net>
wrote:
> > > I think you should go seek help in a forum that knows lots about
vb.net.
> > We
> > > can help you with all the libcurl details you can ask, but this is
not
a
> > very
> > > good place to ask vb.net questions.
> <SNIP>
> >
> > true but the fact is that no matter who i ask, they wont know the
internals
> > of libcurl like you and they wont be able to answer my questions
because
of
> > it, besides if u cant make it into a dll that i can use, then i
would
have
> > to try to port it to vb.net and i hate that idea because of the lack
of
"c"
> > knowledge I have, but i am going to try to compile it myself using
visual
> > studio .net
>
>
> --
> Casey O'Donnell
> RPI STS Department - Graduate Student
>
> http://homepage.mac.com/codonnell/
> http://homepage.mac.com/codonnell/wxblogger/
>
that sux, would anybody be willing to help me with this situation by
making
me a simple dll that will work with vb
please somebody
Received on 2004-08-18