B4J Question send more data to the client with the same call

Discussion in 'B4J Questions' started by Roberto P., Sep 2, 2015.

  1. Roberto P.

    Roberto P. Well-Known Member Licensed User

    I created an app with B4J that exchanges data with the client, with the stream of binary objects (see example:http://www.b4x.com/android/forum/th...device-desktop-and-web-reports.37254/#content)

    I need to be able to send data to the server several times, but this is not possible because the stream is closed and does not allow sending data.

    How can I manage the stream so that it closes?

    Here's an example of code that I want to achieve

    Code:
    Sub Handle(req As ServletRequest, resp As ServletResponse)

     
    for i = 0 to 10
           
    dim myObject as CMyObject
           myObject.inizialize
         
          myObject.calulate(params...)

           SendObject(myObject, resp.OutputStream)

    next

    End Sub
    in this example, it is sent only the first call.

    I hope I was clear.
    thank you
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    This is how http requests work. The client sends a request and the server responds.

    You can use WebSockets if you want to maintain an open, bi-directional connection.
     
  3. Roberto P.

    Roberto P. Well-Known Member Licensed User

    hello Erel,
    thanks for the reply
    I know just the web ... socket can also be used without webpages? or to exchange data between the server and the app B4J B4A?

    there is an example to exchange data between the two systems?

    this would be a good solution, for other needs.

    thank you
    roberto
     
  4. Roberto P.

    Roberto P. Well-Known Member Licensed User

  5. Roberto P.

    Roberto P. Well-Known Member Licensed User

    I did a test and there are limitations in the size of the parameters.

    there is a way to overcome the limits and send via socket size data also some MB?
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    I wouldn't use the web socket to send large objects.

    However you can combine both solutions. Maintain an active web socket connection and use a regular handler to upload or download large objects.
     
  7. Roberto P.

    Roberto P. Well-Known Member Licensed User

    Hello Erel,
    I understand, I see if I can do this combined management. However, we have to open two doors and manage two separate connections.
     
  8. Erel

    Erel Administrator Staff Member Licensed User

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