×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    7

    Question Is it able to sending and receiving data via single RSocket at the same time?

    Hello, everybody:

    I'm new to networking programming. I have a question about using RSocket now.

    The situation is: I'm developing a client for cell phone, which uses RSocket to comunicate with a server. While the client is sending data to the server (using RSocket::Write()), the server may response some times at any time. So RSocket::RecvOneOrMore() is called then. The both function are called asyncly.

    Just like the example "SIPExSocketsEngine" in sdk, i use a class "CSocketsReader" to receive response asyncly and a class "CSocketsWriter" to send request asyncly. They are both Active Object and work on the same RSocket. CSocketsWriter calls" iSocket.Write(*iWriteBuffer, iStatus)" and it's RunL() should be called when the data had been sent. CSocketsReader calls "iSocket.RecvOneOrMore(iContentBuffer, 0, iStatus, iDummyLength)" and it's RunL() should be called when some data had been received.

    I think RSocket::Write() and RSocket::RecvOneOrMore() should work at the same time, but it seems to be that when I'm sending data via CSocketsWriter continuously, CSocketsReader's RunL() is never called, and is called several times when the data sending is finishied.

    Could any one tell me wheather CSocketsWriter and CSocketsReader can use a RSocket to sending and receiving data at the same time? If this way could not done, is there any way can I send and receive data using RSocket at the same time?

    Thank you very much!

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: Is it able to sending and receiving data via single RSocket at the same time?

    Generally a single socket can handle sending and receiving-type requests simultaneously. However due to the cooperative-multi-tasking-nature of active objects, if your sender code is just 'greedy', it can make other objects starving. The Active Scheduler uses a single linked list as I remember, so the order of the active objects matter. Besides physically reordering your code, you can also assign a lower priority to your sender object (which will also result in having it later in the linked list).

  3. #3
    Registered User
    Join Date
    Sep 2009
    Posts
    7

    Re: Is it able to sending and receiving data via single RSocket at the same time?

    Thanks for reply! I checked my code, and the recieve object is created prior to the send object...
    So I choose the later way: set the priority of send object to "EPriorityLow" and the receive object to "EPriorityHigh", and it works!
    Howerer, will my setting have affect to other functions?
    Thank you!

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: Is it able to sending and receiving data via single RSocket at the same time?

    As long as your sender code is the only greedy one, it should work. Are you sending very small amount of data continously? (like individual AMR frames)

  5. #5
    Registered User
    Join Date
    Sep 2009
    Posts
    7

    Re: Is it able to sending and receiving data via single RSocket at the same time?

    Yes, i send amr data. However, i cache the data until 1k byte and then send them altogether. i'm not sure about how much data should i cache. Could you give me some advice about the amount of cached data? i need the client working in 2G cell net!
    Thx!

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: Is it able to sending and receiving data via single RSocket at the same time?

    I have no real ideas, if your latency requirements allow it, you could simply try what happens with 2-4-8K blocks.

  7. #7
    Registered User
    Join Date
    Sep 2009
    Posts
    7

    Re: Is it able to sending and receiving data via single RSocket at the same time?

    Thanks a lot! I'll try it.
    I have a nother question: the amr data is recorded by an AO using CMdaAudioInputStream. In the MaiscBufferCopied() function I transfer the data. The recording AO records amr-fx directly, and I set the recording buffer to 14, which is the frame size of amr-fx. Would it be much too often the MaiscBufferCopied() is called and influence other AOs? Could you give me some advice about how big the buffer I should set to record amr-fx? Thank you!

Similar Threads

  1. RSocket.Send not sending for second time
    By nirtanami in forum Symbian
    Replies: 0
    Last Post: 2009-01-05, 10:14
  2. Sending and Receiving at the same time
    By berny_ in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2006-11-30, 11:26
  3. Bluetooth using RSocket - sending data
    By VigenIssahhanjan in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2006-04-20, 23:23
  4. Sending/receiving through the RSocket
    By chan_fookmun in forum Symbian
    Replies: 0
    Last Post: 2005-12-27, 03:44
  5. Sending and receiving data
    By whitemoon in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2003-09-10, 15:43

Posting Permissions

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