Help In HTTP via RSocket
| Wed, 2007-07-25 08:36 | |
|
Hi to All, ///Code For HTTP; TUriParser url; User::LeaveIfError(sess.Connect()); sockfd.Close(); Also I m interested to access authenticated pages with user name and passward. please tell me how can i do this it will be a great help. Thanks in Advance |
|






Forum posts: 732
I would recommend you to use an ActiveObject (AO) in your case. Or at least a User::WaitForRequest() (but that is not always preferable). Check any of the socket help on SDK, or search in this forum or FN.Wiki/DIBO for the implementations/tutorials.
Forum posts: 73
i tried WaitForRequest() after GetByName() but it is going crash on WaitForRequest
please tell me the solution how i could achieve this
thanks
Forum posts: 68
I also think you need to use an Acrive Object (AO). During the setup of the connection control has to be taken away from your code, and other active objects need to be sheduled, which cannot happen when you use something like WaitForRequest(), I might be confusing it with establishing a secure connection. So you can change to an AO as last resort.
I see you call iHostResolver.Close(), before calling iHostResolver.GetByName(KMyServer, iNameEntry, iStatus), you cannot call this on when it is closed, think of iHostResolver as a file, it must be open to read.
_LIT(KMyServer, "http://72.156.123.253:7001/weblogic6/filechek1"); gives an ip address "72.156.123.253" you don't need a dns lookup, it specifies a port "7001" which you overide/ don't use with address.SetPort (80) .
Try code below.
TRequestStatus iStatus;
err = iHostResolver.Open(sess,KAfInet,KProtocolInetTcp);
User::LeaveIfError(err);
iMyresolveServ.Copy(url.Extract(EUriHost));
TInetAddr address ;
err = address.Input(iMyresolveServ);
if( err != KErrNone ) // something other than an ip adress, a dns name maybe? (www.example.com)
{
iHostResolver.GetByName(iMyresolveServ,iNameEntry,iStatus) ; //do a dns lookup, get ip address
User::WaitForRequest(iStatus);
User::LeaveIfError(iStatus); // leave if the name coudn't be resolved
address = TInetAddr(iNameEntry().iAddr);
}
else // we have a valid IP address (ex. 72.156.123.253)
{
iHostResolver.GetByAddress(address,iNameEntry,iStatus) ; //do a reverse dns lookup, not really necesary
User::WaitForRequest(iStatus);
}
iHostResolver.Close();
address.SetPort (7001) ;
sockfd.Connect(address, iStatus);
User::WaitForRequest(iStatus);
Forum posts: 73
Ok Sir
I got your point if i use only 72.156.123.253 and port 7001 it works properly .
But my motive is other i want to access a jsp page from this that take a user name and password that is the reason i was using "http://72.156.123.253:7001/weblogic6/filechek1".
Please tell me how can i access this,
Thanks to all of u for your favorable reply
Forum posts: 68
Once connected to the server you make a HTTP GET request with the path "weblogic6/filechek1". There is an HTTP API as well as a webbrowser API, which should make things easy, but I have never used them.
Maybe someone else can help you out with that.
Good luck!
Forum posts: 73
Hi Werries
I will do the same as u suggested and get back the result...........
Thanks
Forum posts: 73
Hello Sir,
I am not getting the solution please tell me how can i send a user name and password .
Thanks
Forum posts: 68
Don't know if this will be of use but take a look at Symbian_OS_End-to-End_Sockets_API_Example_v1_3_en
and Symbian_OS_End-to-End_HTTP_API_Example_v1_3_en
at Forum Nokia
Forum posts: 73
Hi to All,
Finally i have developed a symbian client and a web based servlet and i can connect my client to servlet via RSocket Connection but have another issue. I need to send a string from my client to servlet and I dont know how to send this. this time i m using
_LIT8(KDataToWrite,"GET /TimeProject/trylogin HTTP/1.0\xD\xA\xD\xA");
sockfd.Write(KDataToWrite,iStatus);
To connect with my servlet but if i want to send a string on this servlet like "hello" what should i do .
Please tell me how can i do this
Thanks in advance.