Results 1 to 8 of 8
  1. #1
    Member
    Join Date
    Dec 2009
    Location
    Oberentfelden
    Posts
    2

    Unhappy Hello World Remote Socket Adapter

    Hello everyone
    I'm very very new to LS
    I tested the example with remote adapter from the website: http://cometdaily.com/2008/07/29/hel...lightstreamer/

    the example worked perfect for me, but when I close the telnet sessions the LS server is shutting down too

    Is there a way that the LS Server is not shutting down?

    Thanks a lot for reply

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,089
    This behavior is forced by the mounted com.lightstreamer.adapters.remote.data.NetworkedDa taProvider, as it would not be able to honour the subscription requests with no feed connected.

    An alternative is com.lightstreamer.adapters.remote.data.RobustNetwo rkedDataProvider, which overcomes the temporary lack of the feed with some arbitrary assumptions.
    See this post.

  3. #3
    Member
    Join Date
    Dec 2009
    Location
    Oberentfelden
    Posts
    2
    thanks a lot, that solved my problem

    I have an other question
    Is there a java api to transform the telnet stuff into java?
    I've found the .Net example but i can't see how i have to do this in java.

    Or do I have to open the sockets by hand in java and write to it?

    thanks for your help

  4. #4
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    521
    Java Adapters usually run in-process with the Lightstreamer Server, so you don't need to use the socket-based protocol. In such case, you will use the provided Java API (as introduced in this tutorial).

    Only in case you have a requirement to make the Java Adapters run on a different machine than the Lightstreamer Server, you should actually open sockets by hand and implement the Lightstreamer network protocol.

  5. #5
    Member
    Join Date
    Mar 2010
    Location
    Hyderabad
    Posts
    5

    Remote Adaptor

    Hi Alessandro,
    I am trying to use com.lightstreamer.adapters.remote.data.RobustNetwo rkedDataProvider. Everything is going well. But the problem is, for each subscription from the client an Unique id is created and sent from Proxy Adaptor to the counter part. When I send reply from counterpart to Proxy adapter need to add the Unique Id. So each client will have defferent Uniue ID for the same item subscription. When more clients getting added need to maintian more Unique IDs for reply in the remote adaptor. Even if a client unsubscribes, I will not get the unsubscirbe notification untill all the clients unsubscribes for that particular item and also that will not provide the client identification. So it is very difficult to maintain these many Unique IDs in the remote adaptor.
    Is there any solution to Identify a partuclular Clint is unsubscribe to a particular Item.
    Request you to Please try to provide a solution for this problem.

    Thanks in advance.

  6. #6
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    521
    The unique ID is associated to the item, not to the user. Remember that the Data Adapter is completely shielded from the actual users subscribing to an item. It receives a subscription when the first user subscribed to an item, it receives an unsubscription when the last users subscribes to that item, and not notifications happen in the middle.

    On the other hand, the user identity for each subscription and all the authorization logic is handled by the Metadata Adapter.

    See ARI "Protocol.pdf" for a full description of the protocols used for both the Data Adapter and the Metadata Adapter.

  7. #7
    Member
    Join Date
    Mar 2010
    Location
    Hyderabad
    Posts
    5
    Thank you very much for the reply..

    Sorry for asking one more question. When I try to write Item Update using java socket programing , getting the follwoing error.

    11.Apr.10 14:20:35,054 <ERROR> Exception caught while subscribing to item 'item0
    ': Connection closed while waiting for an answer to request 300000127ec1000c8
    11.Apr.10 14:20:35,058 <ERROR> Exception caught while subscribing to item 'item1
    ': Connection closed while waiting for an answer to request 200000127ec1000c8
    11.Apr.10 14:20:35,060 <ERROR> Exception caught while subscribing to item 'item2
    ': Connection closed while waiting for an answer to request 100000127ec1000c8
    11.Apr.10 14:20:35,061 <ERROR> Got fatal error from the inner Proxy Data Adapter

    com.lightstreamer.adapters.remote.RemotingExceptio n: Unexpected end of notify st
    ream reached
    at com.lightstreamer.adapters.remote.request_reply.No tifyReceiver.run(No
    tifyReceiver.java:83)
    Caused by: java.io.EOFException
    ... 1 more


    I am using the following code..Please let me know where I am doing the wrong.


    package com.chevron;
    import java.io.*;
    import java.net.*;

    public class LSRemoteAdaptorClient implements Runnable{


    Socket echoSocket = null;
    PrintWriter out = null;
    BufferedReader in = null;
    boolean disconnect = false;

    String message;

    DataOutputStream outToServer = null;

    public void init() throws IOException {

    try {
    echoSocket = new Socket("127.0.0.1", 7002);
    out = new PrintWriter(echoSocket.getOutputStream(), true);
    in = new BufferedReader(new InputStreamReader(
    echoSocket.getInputStream()));
    outToServer = new DataOutputStream(echoSocket.getOutputStream());



    } catch (UnknownHostException e) {
    System.err.println("Don't know about host: taranis.");
    System.exit(1);
    } catch (IOException e) {
    System.err.println("Couldn't get I/O for "
    + "the connection to: taranis."+e);
    System.exit(1);
    }


    }

    @Override
    public void run() {
    // TODO Auto-generated method stub

    while (!disconnect) {
    //out.println(userInput);

    try {
    if(message!=null){
    System.out.println("Writing Message"+message);

    //out.write(message);
    try {
    outToServer.writeBytes(message+"\n");
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }
    Thread.sleep(1000);
    } catch (InterruptedException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }

    out.close();
    try {
    in.close();
    echoSocket.close();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }


    }
    }


    Thanks in advance..................

  8. #8
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    521
    You should hanlde both ports 7001 and 7002 at the same time, as pointed out in the socket tutorial.

    But I paste below the advice I previously gave in this same thread:

    Java Adapters usually run in-process with the Lightstreamer Server, so you don't need to use the socket-based protocol. In such case, you will use the provided Java API (as introduced in the Java tutorial). Only in case you have a requirement to make the Java Adapters run on a different machine than the Lightstreamer Server, you should actually open sockets by hand and implement the Lightstreamer network protocol.

 

 

Similar Threads

  1. Hello World -- Socket
    By mohelal84@yahoo.com in forum Adapter SDKs
    Replies: 5
    Last Post: March 25th, 2015, 10:26 AM
  2. Newbie Java Remote Adapter question
    By webmons in forum Adapter SDKs
    Replies: 3
    Last Post: March 7th, 2013, 10:30 AM
  3. Replies: 5
    Last Post: April 30th, 2010, 11:03 AM
  4. Replies: 9
    Last Post: June 3rd, 2009, 10:56 AM
  5. "Hello World" Data Adapter [.NET]
    By Alessandro in forum Adapter SDKs
    Replies: 3
    Last Post: May 30th, 2008, 02:49 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 07:37 AM.