×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Regular Contributor
    Join Date
    May 2007
    Posts
    73

    HTTP POST to stream data

    Hello

    I am making a project in symbian c++ s60 to connect to a server and retrive data from it.
    A similar program was made in J2Me but i cant find similar methods for the Java methods.

    What i reached so far as the HTTPCleintExampe i made every thing except i want to post a data stream or to make methods like writeUTF or writeInt in Java.

    I have the iPostData but i don't actually understant how does the procedure go.

    so how to do the following in symbian c++ s60 if in java it is like this:
    con = (HttpConnection) Connector.open(url, Connector.READ_WRITE);
    con.setRequestMethod(HttpConnection.POST);
    outStream = new DataOutputStream(con.openOutputStream());
    outStream.writeInt(0);
    outStream.writeUTF("data");

    please help

  2. #2
    Super Contributor
    Join Date
    Oct 2005
    Posts
    739

    Re: HTTP POST to stream data

    I think you have to set all headers and open a socket connection like this
    Code:
    buffer.Copy(KPost);
    	buffer.Append(aURL);
    	buffer.Append(KHTTP);
    	buffer.Append(KNewLine);
    	buffer.Append(KPostSize); 
    	buffer.AppendNum(temp.Length());
    	buffer.Append(KNewLine);
    	buffer.Append(KPostMime); 
    	buffer.Append(aMimeType);
    	buffer.Append(KNewLine);
    	buffer.Append(KNewLine);
    	buffer.Append(temp);
    	buffer.Append(KNewLine);
    	
      	TInt aSocket = iSocketV.Open(iSocketServ, KAfInet, KSockStream, KProtocolInetTcp);//,iConnection);             	  	
        if(aSocket==KErrNone)
         {       
           iState = EStateConnected;
           iAddress.SetPort(KDefaultPortNumber);   	
    	   iAddress.Input(KDefaultServerName);		
    	   iAddress.SetAddress(iAddress.Address());	 	   
    	   iSocketV.Connect(iAddress, iStatus);
    	   SetActive();	     
         }
    KPost ,"POST "
    KHTTP ," HTTP/1.0"
    KPostSize ,"Content-Length: "
    KPostMime ,"Content-Type: "
    aMimeType,("text/plain")


    Hope this will help you.

    Peter

  3. #3
    Regular Contributor
    Join Date
    May 2007
    Posts
    73

    Re: HTTP POST to stream data

    Thans for your reply
    I was wondering shouldn't i use the code from the HTTPCleintExample or if I will use this code in the example where should I put it in the GetNextDataPart or ReleaseData or OverallDataSize.

    In your code I can't understant where is the part of sending the data like sending a 4 bytes integer and sending a string after it.


    Hoping for Help.

  4. #4
    Super Contributor
    Join Date
    Oct 2005
    Posts
    739

    Re: HTTP POST to stream data

    Quote Originally Posted by alikhairat
    Thans for your reply
    I was wondering shouldn't i use the code from the HTTPCleintExample or if I will use this code in the example where should I put it in the GetNextDataPart or ReleaseData or OverallDataSize.

    In your code I can't understant where is the part of sending the data like sending a 4 bytes integer and sending a string after it.


    Hoping for Help.
    The code i have posted is only for establishing a connection. You should write to the socket for sending a string or integer.

    iSocket.Write(buf,iStatus);//here buf containes the data to be send
    SetActive();

    Hope you understand me.

    Peter

  5. #5
    Regular Contributor
    Join Date
    May 2007
    Posts
    73

    Re: HTTP POST to stream data

    -So I establish a new socket connection and not a session and a transaction.
    In the method setupconnection there is a variable defined iSocketServ so should i use another variable.

    -can you please define and explain for me the variables (aURL,KNewLine,temp.Length,temp,
    TInt aSocket = iSocketV.Open(iSocketServ, KAfInet, KSockStream,KProtocolInetTcp);//,iConnection);
    if(aSocket==KErrNone)
    {
    iState = EStateConnected;
    iAddress.SetPort(KDefaultPortNumber);
    iAddress.Input(KDefaultServerName);
    iAddress.SetAddress(iAddress.Address());
    iSocketV.Connect(iAddress, iStatus);
    SetActive();
    }
    ) in the code you have written.

    -buffer already contains the data or shall i append the the data after the code.
    also should i define buffer and iSocket in the header file or in the method.

    - where will I be recieving the data.
    sorry I am really new in networking using Symbian C++

    Thanks alot for your help

  6. #6
    Super Contributor
    Join Date
    Oct 2005
    Posts
    739

    Re: HTTP POST to stream data

    Hi

    Give me your mail id i will pass you an example code.

    Peter

  7. #7
    Regular Contributor
    Join Date
    May 2007
    Posts
    73

    Re: HTTP POST to stream data


  8. #8
    Registered User
    Join Date
    May 2007
    Posts
    5

    Re: HTTP POST to stream data

    Dear Peter
    I would like to have one copy of your example code.
    Please , my email hieu@macatung.com
    Regards,
    Hieu

  9. #9
    Regular Contributor
    Join Date
    Apr 2009
    Posts
    442

    Re: HTTP POST to stream data

    Hi

    Please send me also.

    taruna.gajera@gmail.com

  10. #10
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    63

    Re: HTTP POST to stream data

    To me also please.

    dispatchmails@gmail.com

  11. #11
    Registered User
    Join Date
    Nov 2009
    Posts
    40

    Re: HTTP POST to stream data

    Quote Originally Posted by vinothg View Post
    To me also please.

    dispatchmails@gmail.com
    Could u pls sent me too??

    my id is topradeeja@gmail.com

  12. #12
    Registered User
    Join Date
    Dec 2009
    Posts
    2

    Re: HTTP POST to stream data

    Quote Originally Posted by SymbianTH View Post
    Hi

    Please send me also.

    taruna.gajera@gmail.com
    1. How can i get the latest firmware upgrader software to convert into latest version than v 4.0839.42.0.1 for my Nokia N73.......pls help me.....

Similar Threads

  1. Receiving data form HTTP POST
    By kenpo in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2007-07-08, 09:42
  2. Replies: 3
    Last Post: 2007-03-24, 16:53
  3. ExampleClientEngine ...
    By GeKI in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2005-12-16, 07:12
  4. suckho, i have encontered the same problems. Could you tell me how you resolved it?
    By dicson_hu in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2005-12-09, 10:56
  5. 7650 J2ME/MIDP HTTP Post
    By cwalkinshaw in forum Mobile Java General
    Replies: 2
    Last Post: 2002-10-23, 10:12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •