This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Duplex communication using NDK

I want to use NDK to perform duplex communication between PC and DSP.

But I don't know how to get this.

I have some design:

  1. There are only one pair sockets in system.
    One in PC and the other in DSP.
    DSP is server and PC is client.
    In DSP programme, I am going to make two task to work.
    One task recieves data ,and the other task sends data.
    But when I want to use SOCKET like "stcp/stcpactive" as global variable,NDK doesn't
    work.
    Can SOCKET variable be global?
    Can SOCKET variable be used in more then one task just like normal global variable?

  2. If SOCKET variable can only be used in one task,how to perform duplex communication in one task?
    I know that fdselect() is the blocking function that waiting for multiple events.
    It can wait for reading/writing/exceptional conditions.
    If there is a new socket to connect to server,fdselect() can wake up.
    Then DSP can recieve
    or send data to PC.This is for "reading".
    But how about "writing" and "exception"?
    If when I want to send a data to PC anytime, how can I wake up fdselect() and wake up task?

  3. If I can't wake up fdselect() when I want to send data from DSP to PC,
    Can I use
    mutiple pair of sockets in project?
    One socket in DSP listen and recieve from PC,and DSP is server.
    The other pair of socket send data to
    PC,and DSP is client.
    They use different ports.
    Is this executable?

I only want to use NDK to perform duplex communication between PC and DSP.
Is there anybody did this?
How to get this?

This is urgent.
Thank you for your help.

  • Hello,

    I am interesting in excatly same problem. Do you have some more information about this theme? I cant find the solution of this problem. Are you?

    thanks

  • I tried two ways to get duplex communication.

    1. First I use two pair of sockets ,one is for downlink and the other is for uplink.
      This way is all right.It is workable.
    2. Then I found one socket can be used in other TSK.
      Note that the name of socket don't be the same as other sockets that are used as local somewhere.
      And the TSK that use the socket must  execute "fdOpenSession( TaskSelf() );".

    These ways are all workable.

    Hope this will help you .
    Best Regard.