hdl = InternetOpen(...) ;
session = InternetConnect(hdl, "www.somesite.com", port, ...) ;
req = HttpOpenRequest(session, "POST", "page1.asp", ...);
With System.Net, I would do the following:
HttpWebRequest req = (HttpWebRequest)
WebRequestFactory.Create(www.somesite.com);
WebResponse resp = req.GetResponse();
The System.Net does not have the notion of session.
Does that means that the session is implicitly kept if I stay in the site ?
Could you show me some code equivalent tot he Wininet fragment above?
Thanks,
tom.
"Josh" <joshr...@yahoo.com> wrote in message
news:#UDdKMkTAHA.174@cppssbbsa04...
> The use is very similar....tell me what you are exactly trying to
accomplish
> and I'll show you in C# how to do it.
>
> --
> Sincerely,
>
> Josh Mitts
> joshr...@yahoo.com
> ICQ: 77964060
>
>
> "Thanh Nguyen" <tom...@sympatico.ca> wrote in message
> news:ON#Z9rdTAHA.76@cppssbbsa05...
> > Hi,
> > I wrote a search engine using Wininet.
> > Now I would like to port it to the .Net framework.
> >
> > Is there a site that shows a sample ?
> > (I saw the one posted on the msdn dotnet site.
> > But it is rather too basic).
> >
> > thanks in advance.
> > tom.
> >
> >
>
>
OK, first of all, I am not totally sure why you would want to keep the
session alive (remember, HTTP is a session-less protocal)...but here's one
implementation using a Stream:
HttpWebRequest req = (HttpWebRequest)
WebRequestFactory.Create("www.microsoft.com");
HttpWebResponse resp = req.GetResponse();
resp.GetResponseStream(); // provides a stream object which can be used to
access the data in a stream
To go beyond that and use a Socket connection to the server like you do in
WinInet, that's a whole different ball of wax, but I think it is what you
are trying to accomplish. To begin, take a look at the System.Net.Sockets
class. That contains all of the underlying classes to allow direct socket
connections to servers. The one you will probobly use is
System.Net.Sockets.TCPClient. For example:
TCPClient tc = new TCPClient("www.microsoft.com", 80);
tc.Connect();
NetworkStream myStream = tc.GetStream();
myStream.BeginRead(...); // and other NetworkStream methods, etc.
Hope that helps!
--
Sincerely,
Josh Mitts
joshr...@yahoo.com
ICQ: 77964060
*** Please reply in the newsgroup, I am unable to answer any e-mail
questions. Thanks! ***
"Thanh Nguyen" <tom...@sympatico.ca> wrote in message
news:#Be8QZrTAHA.243@cppssbbsa03...
I guess that the simplest would be to write a test program.
I will post my result, unless somebody responded before.
thanks Josh.
"Josh Mitts" <joshr...@yahoo.com> wrote in message
news:uFN59zwTAHA.278@cppssbbsa03...
--
Sincerely,
Josh Mitts
joshr...@yahoo.com
ICQ: 77964060
*** Please reply in the newsgroup, I am unable to answer any e-mail
questions. Thanks! ***
"Thanh Nguyen" <tom...@sympatico.ca> wrote in message
news:uRUGvL4TAHA.196@cppssbbsa04...