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.

Opening multiple sockets for FTP transmission over LAN

Other Parts Discussed in Thread: TM4C1294NCPDT

Hi,

Target: TM4C1294NCPDT


I am trying to open multiple sockets for FTP transmission over LAN. For FTP transmission I require two sockets, one socket will connect to server and other socket will connect to the client socket for sending data to server. I need both sockets to alive and work independently. Please suggest me any example or procedure for the same.

Regards

Jeetesh

  • Jeetesh,

    You can simply create and open two sockets, so I think your question is more about concurrency issue. Have I got this correct?

    One approach is to create a task for each socket. When each task blocks on a socket read call, it will wakeup and run when there is data available on that socket. However, this approach has a larger overhead and does not scale well to many sockets.

    A more advanced approach is to use the select function. Using each socket, you set a bit in the select mask. Then your task will block on the select function call. When either (or both) sockets have data available, your task will return from the select call. You inspect the return mask to see which socket has data and then you can safely call read on that socket because it will return immediately. The NDK provides the implementation for the select function.

    Please indicate the software version you are using.

    ~Ramsey