×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Oct 2007
    Location
    Noida
    Posts
    152

    Substitute of java classes in Symbian ?

    hello All,

    I am a bit new to the netwoking part of the Symbian c++. I have created a project in java but now i want to do the same in Symbian c++.

    I have a few classes in java that i have created. I was wondering that if someone can help me with a bit of conversion.

    to start with . the following code fragment is written in j2me which i need to convert in Symbian c++. The class XmlWriter has to be extended from Outputstream so that i can send the text data to my server.


    Code:
    public class XmlWriter extends OutputStreamWriter
    some ideas please for which is the substitute classes OutPutStreamWriter/InputStreamReader in Symbian C++.

    and then this code
    Code:
    SocketConnection sc =(SocketConnection)Connector.open(//some ipaddress and port no.);
    OutputStream os = sc.openOutputStream();
    InputStream is = sc.openInputStream();
    some substitute classes for SocketConnection,OutputStream,InputStream etc.

    some sample code if i can go thru. anything at all will be of great help.
    Abhishek karmakar

    never- Never - NEVER -- !!! NEVER !!! GIVE UP

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: Substitute of java classes in Symbian ?

    Honestly i dont know java, so i am not aware of functionality of class OutPutStreamWriter/InputStreamReader in java. Symbian has many stream interface classes, you can check it at » Symbian OS v9.1 » Symbian OS reference » C++ component reference » Syslibs STORE . Also check RSocket and RSocketServ class in SDK.

  3. #3
    Registered User
    Join Date
    Oct 2007
    Location
    Noida
    Posts
    152

    Re: Substitute of java classes in Symbian ?

    hey thanks savaj,
    actually i started looking at the RSocket class as soon as i posted this.. neways thanks for the help.
    Abhishek karmakar

    never- Never - NEVER -- !!! NEVER !!! GIVE UP

  4. #4
    Registered User
    Join Date
    Mar 2009
    Posts
    6

    Re: Substitute of java classes in Symbian ?

    Hello welcome to symbian C++,

    You can create TCP connection using RSocket as
    [CODE]//---Instance variables
    RSocketServ iSocketServer;

    RSocket iSocket;

    TInetAddr inetAddress;

    RConnection iConnection;

    User::LeaveIfError(iSocketServer.Connect());

    User::LeaveIfError(iConnection.Open(iSocketServer));

    inetAddress.SetPort(9090);

    const TUint32 Kaddr = INET_ADD(192,168,1,2);
    inetAddress.SetAddress(Kaddr);

    // ---------you need to connect to GPRS in real device , note emulator can not handle RConnection --//

    #ifndef __WINS__

    TBool connected = EFalse;



    // Lets first check are we already connected.

    TUint connectionCount;

    User::LeaveIfError(iConnection.EnumerateConnections(connectionCount));

    TPckgBuf<TConnectionInfoV2> connectionInfo;

    for (TUint i = 1; i <= connectionCount; i++)

    {

    User::LeaveIfError(iConnection.GetConnectionInfo(i, connectionInfo));

    if (connectionInfo().iIapId == iSettingsInfo.DefaultIap())

    {

    connected = ETrue;

    break;

    }

    }



    // Not yet connected, start connection

    if (!connected)

    {

    //Define preferences for connection

    TCommDbConnPref prefs;

    prefs.SetIapId(0);
    // 0 -default iap id
    prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);



    iConnection.Start(prefs, iStatus);

    SetActive();

    return;

    }

    #endif // __WINS__

    #ifdef __WINS__

    // Emulator can't handle RConnections

    socketErr = iSocket.Open(iSocketServer, KAfInet, KSockDatagram, KProtocolInetTcp);



    #else

    socketErr = iSocket.Open( iSocketServer, KAfInet, KSockDatagram, KProtocolInetTcp, iConnection );

    #endif

    iSocket.Connect( iAddress, iStatus );

    iSocket.send(data,0, iStatus);[CODE]
    Note: You have to wait for iStatus,
    Last edited by md.abdulmca; 2009-06-05 at 11:05.

  5. #5
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: Substitute of java classes in Symbian ?

    Use tag [CODE ] code here [CODE ] (without space) to past code.

  6. #6
    Registered User
    Join Date
    Oct 2007
    Location
    Noida
    Posts
    152

    Re: Substitute of java classes in Symbian ?

    hey thanks very much md.abdulmca .
    that was helpful
    Abhishek karmakar

    never- Never - NEVER -- !!! NEVER !!! GIVE UP

Similar Threads

  1. Replies: 1
    Last Post: 2009-01-19, 08:58
  2. java and symbian
    By sarasara82 in forum Mobile Java General
    Replies: 1
    Last Post: 2008-01-28, 09:19
  3. Question regarding Java vs Symbian C++
    By Olnex in forum Mobile Java General
    Replies: 5
    Last Post: 2006-09-27, 23:53
  4. Replies: 2
    Last Post: 2004-05-08, 09:09
  5. Replies: 0
    Last Post: 2004-05-07, 11:45

Posting Permissions

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