Android Question Using Serversocket from two different apps

Discussion in 'Android Questions' started by rboeck, Jan 29, 2015.

  1. rboeck

    rboeck Well-Known Member Licensed User


    i have created an app, which is connected to an b4j app and is able to send text from the android app to the pc and write at the cursor position.
    Now i had another idea for an second app, which also will use the above pc util to transfer text. When the second app starts an come to the statement server.initialize i get the error: Adress already in use.

    What are my possibilities: is there the possibility, to temporary close the first connection and switch the connection to the second app and how to i do?
    Or should i make an another port adress for the second app and try to use the pc utility watching for two different ports?
  2. Erel

    Erel Administrator Staff Member Licensed User

    The port can only be bound to a single ServerSocket.

    I recommend you to use two different ports.

    A better option is to make the PC the server and use WebSockets (as in the custom push framework example).
  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