Android Question Socket Server in B4A with multible inbound connections

Discussion in 'Android Questions' started by TheMightySwe, Aug 19, 2015.

  1. TheMightySwe

    TheMightySwe Active Member Licensed User


    Quick question, has anyone a code snippet how to have one server socket listening and be able to connect several clients to that socket in a simple way. I need to send and recieve varables like a list of maps through the connection.

    // TMS
  2. Lee Gillie CCP

    Lee Gillie CCP Active Member Licensed User

    Check the tutorial. There are tons of great examples prepared with explanations. A lot of great work already done, seek it out.

    It is not clear to me if the NEWCONNECTION event arrives on the main thread or not. My guess is that it does. So the only thing I might add is that if your connections are long-lived (not quick and transitory), then you can spin the NEWCONNECTION event into a new thread just prior to the call to LISTEN in NEWCONNECTION. Dynamically connect event handlers to NewSocket in this case. If you simply reply and close, then none of this is necessary of course.

  3. TheMightySwe

    TheMightySwe Active Member Licensed User

    It is long lived connections, and the first part is already done, the part in the tutorial. So I try to figure it out my self.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice