This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Multiple BSD connections

Hi,

To establish more connections using BSD sockets, I need to determine the best approach.

1)Should I implement multiple threads for this purpose? For example, I could use a threading model similar to the following:

https://www.keil.com/pack/doc/mw6/Network/html/group__bsd__routines.html#ga7005ffbeeff92be5394ff3244da79028

2) Alternatively, should I create a server thread and utilize the listen function with a backlog argument greater than 1? If that’s the case, I would need to manage incoming connections using the accept function to ensure they are handled.

3) As I see the Network debug window details, there is a bsd_cb_tcp callback function, but there is no information on how to implement or use it, Is there any resource?

4)How can I get the BSD socket states, such as Established, Connected, or others?"

5)Is there a function to determine the amount of available memory

Parents
  • Dear Andreas Barth,

    Thank you so much for your response! I truly appreciate your help. I have a couple of questions that I hope you can assist me with:

    1. When I define two threads consecutively with the same priority, only the one thread seems to run continuously, even when using a round-robin scheduling method. Do you have any suggestions on how I can resolve this issue?

      osThreadCreate (osThread(Server), (void *)SOCK_STREAM);
      osThreadCreate (osThread(Server), (void *)SOCK_STREAM);
    
      while(1) {
        osSignalWait (0, osWaitForever);
      }

    1. Regarding the listen(sock, 1) command, should the second argument remain as 1 when using different server threads? I'm concerned that it may not be able to handle multiple socket connections in blocking mode.
    2. could you provide an example of how to use ioctlsocket? There is no additional information about how to handle the "accept" function after non-blocking listen function.
    3. Are there any examples of implementing multiple BSD connections using the listen function?

    Thank you again for your assistance.

Reply
  • Dear Andreas Barth,

    Thank you so much for your response! I truly appreciate your help. I have a couple of questions that I hope you can assist me with:

    1. When I define two threads consecutively with the same priority, only the one thread seems to run continuously, even when using a round-robin scheduling method. Do you have any suggestions on how I can resolve this issue?

      osThreadCreate (osThread(Server), (void *)SOCK_STREAM);
      osThreadCreate (osThread(Server), (void *)SOCK_STREAM);
    
      while(1) {
        osSignalWait (0, osWaitForever);
      }

    1. Regarding the listen(sock, 1) command, should the second argument remain as 1 when using different server threads? I'm concerned that it may not be able to handle multiple socket connections in blocking mode.
    2. could you provide an example of how to use ioctlsocket? There is no additional information about how to handle the "accept" function after non-blocking listen function.
    3. Are there any examples of implementing multiple BSD connections using the listen function?

    Thank you again for your assistance.

Children
No data