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:
- 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? - 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? - 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.