cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Re: so is it possible to reference(akainclude)libcurlintovb.net or what?

From: Michael Mastroianni <MMastroianni_at_choicestream.com>
Date: Wed, 18 Aug 2004 15:52:17 -0400

I've never used VB, so I don't know what msflexgrid is. I think most/all
of the c# packages have analogues in vb.

Here's a blurb from MSDN
This example determines whether the specified Web site responds.

Example
Try
    Dim siteUri As New System.Uri("http://www.microsoft.com")
    Dim webRequest As System.Net.WebRequest = _
        System.Net.WebRequest.Create(siteUri)
    webRequest.Proxy = New System.Net.WebProxy("YourProxySetting")
    Dim webResponse As System.Net.WebResponse = webRequest.GetResponse()
Catch ex As Exception
    ' The Web request failed.
End Try
Compiling the Code
This example requires:

A reference to the System.Web namespace.
If the Web site does not exist, an exception is thrown by the
GetResponse method.

The value of webRequest.Proxy will depend on your network. For more
information, see WebRequest.Proxy Property and WebProxy Class.

Robust Programming
The following conditions may cause an exception:

The Uri does not exist (WebException Class).
The proxy is incorrectly set (UriFormatException Class).
The Uri is not in the proper format (invalid characters, and so forth)
(WebException Class).

-----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 3:36 PM
To: libcurl development
Subject: Re: Re: so is it possible to
reference(akainclude)libcurlintovb.net or what?

----- Original Message -----
From: "Michael Mastroianni" <MMastroianni_at_choicestream.com>
To: "libcurl development" <curl-library_at_cool.haxx.se>
Sent: Wednesday, August 18, 2004 2:54 PM
Subject: RE: Re: so is it possible to reference(aka
include)libcurlintovb.net or what?

> 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
>

i think thats what i did but not entirelly sure
its possible that i messed up in the thread department but i'll take a
second look at it tonight cuz its laundry day and i gotta get going
btw one more thing: last time i installed vs.net i had msflexgrid but
now
that i load my project on my "so called new" pc it doesn't seem to find
it,
just incase you had this problem please respond otherwise ignore cuz i
know
this mailing list has nothing to do with ms
Received on 2004-08-18