B4J Question Multiply connection

Discussion in 'B4J Questions' started by micro, May 26, 2015.

  1. micro

    micro Well-Known Member Licensed User

    Hi to all
    I have 60 device configured as a server, now I, from the pc to connect with them (writing and reading)
    can I create multiple client connections for each device and thus have independence in the connections?
    Each connection must update a data table for each device.
    With a single connection I lose time to interrogate a device at a time.
    It's possibile with B4j?
    Thanks
     
  2. ArminKH

    ArminKH Well-Known Member

    yes you can
    i think you should following this steps
    1-At first you must register your users with specific ID on your Online Database
    2-build your server by b4j
    3-connect to server from b4a
    4-if connected then you can send your user id to server
    5-if ID recieved to server side then you can select and update your online data base 4 Relevant ID
    now any other user on your server can recieve updated data
    i think this steps are correct but @Erel can said this is correct and is best way or not
    regards
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Yes.

    See the CCTV example (the example in the second post).

    Though I recommend you to avoid working with sockets and create a real server. Maybe a web socket server like this one: http://www.b4x.com/android/forum/threads/40272/#content
     
  4. micro

    micro Well-Known Member Licensed User

    Thanks
    Best regards
     
  5. micro

    micro Well-Known Member Licensed User

    Excuse me Erel antother question (a bit of confusion), I decided for ease to use the example of CCTV.
    As I said, the devices are server and the descktop application (b4j) is the client, in b4j
    i have to create n client for ever device and use different port?

    Code:
    Private client_1 As Socket
    Private client_2 As Socket
    ..........
    client_1.Initialize(
    "client_1")
    client_2.Initialize(
    "client_2")
    ..........
    client_1.Connect(ip1, 
    60015000)
    client_2.Connect(ip2, 
    60025000)
    ..........
    Is this correct?
    Or do you recommend another solution?
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    No. See the example.
     
  7. micro

    micro Well-Known Member Licensed User

    Ok....
    It's possible send the same data to a group of ip without cycling the various ip?
    If more device trasmitting at the same time (It is easy to occur), I can lose some data?
    The stack TCP/IP as it is wide?
    I'm sorry but I have to study well the best mode
     
    Last edited: Jun 25, 2015
  8. Erel

    Erel Administrator Staff Member Licensed User

    No. You need to send it to each socket separately.
     
Loading...
  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