Socket callback

hi there.
i want my scrip to react on messages from a socket.
i tried something like this.
Test.prototype.constructor = Test;
function Test()
    this.socket = new Socket;
    this.socket.timeout = 10;
    var con = this.socket.open("127.0.0.1:9876","UTF-8");
Test.prototype.test = function()
    var target = 'indesign-8.0';
    var m = new BridgeTalk();
    m.target = 'indesign-8.0';
        while(true)
        var res = this.socket.read();
        if(res.length > 0)
         m.send();
            alert(res);
            else
            $.sleep(50);
    Model.init();
var t = new Test();
t.test();
this kind of works. an "alert" is shwon every time i send a message from the other side.
but the while loop will block everything else. is there a way to prevent this?
i also had the idea to implement a threaded socket in a c++ library, but it seems i can non use callbacks from an external object?
i can not see a way of calling a javascript function from my c++ library. i can only react on calls.
please ask if i'm not clear as to what i'm trying to do.
cheers
jm

i thank you again my friend
i already read the documentation though
i'm a developer btw. not a designer. so i know some things or two...i may be missing something thought
cheers!
jm

Similar Messages

  • LabView data socket callback

    does the LabView data socket object support a callback mechanism or event like the object for Measurment Studio does?

    dbru,
    I do not believe the exact functionality you are describing in Measurement Studio is implemented in the same way using LabVIEW.  Can you go into more detail of what you are trying to accomplish?  Perhapse there is another method or work around. 
    Mark
    LabVIEW R&D

  • Test Socket PreStep Callback

    Hi:
    I'm trying to create a trace file that contains information on every single step executed by Teststand. I do not want to have to edit any test sequence files, only the model files. I have tried using sequence callbacks StationPreStep (StationCallbacks.seq), ProcessModelPreStep (BatchModel.seq) and SequenceFilePreStep (BatchModel.seq). All of these only show me some of the steps. I do not see step results for any of the test sockets. I only see steps that have been called by the controlling 'Test UUTs' socket. 
    Can anyone tell me how to implement a PreStep callback on the test socket steps without editing any test sequence files?
    Thanks,
    Dave

    Nevermind.... the callbacks work. It was a different problem. I was enabling the tracing via a variable that was only enabled on Test UUTs. Working now!

  • How to set the number of sockets for batch processing at runtime?

    Hello all,
    I need to change the execution model at runtime. I have achieved this by setting the 'ModelPath' property of the sequence file at runtime. When I set the sequence file model as batchmodel, i need to set the number of test sockets also dynamically. How can this be done? Once i set the number of sockets, i would also have to set the UUT serial number for each socket. Please help me out in solving this.
    Thanks and Regards
    Madhu Srinivasan.

    Hi Madhu,
        You can do this by inserting a sequence file callback into your main sequence and choose the ModelOptions callback. You can then use the expression step to set the "Parameters.ModelOptions.NumTestSockets" value to whatever you want. If you then use the Test UUTs execution entry point you will be prompted for serial numbers automatically. You could also use this same procedure but alter the ModelOptions callback in the process model directly, either way works just as well but I think that using a sequence file callback gives a bit more flexibility in the system.
    Hope this helps,
       Nick

  • How to change Number of test socket in Model option during run-time

    I wanna be able to change the the number of test sockets(in the Model Options menu) during runtime. I have overriden the Prebatch callback and used my own instead. I have a LabView program in my Prebatch where I would select the test script each time before running the batch. I wann be able to also modify the number of test sockets each time before I run the batch again. I tried setting the "Parameters.ModelData.ModelOptions.NumTestSockets" from the Labview program which is in my Prebatch before running each batch, but get into errors. Please help?

    Hello Kumar,
    The Batch process model shipped with TestStand does not handle this scenario, but you can still do this. Attached is a sequence file that utilizes the Batch Model's ProcessCleanup callback to reset the next execution point. It still uses the method of setting the Parameters.ModelOptions.NumTestSockets variable in the PreBatch callback. The change I added was three steps to a different callback (the ProcessCleanup callback):
    Message Popup - prompts Yes or No to continue testing with a new batch size.
    Statement 1 - based on the response to the message popup (via precondition), resets the Batch Model's next step to be executed and the ContinueTesting flag:
    RunState.Root.RunState.StepGroup = "Setup"
    RunState.Root.RunState.NextStepIndex = 0
    RunState.Root.Locals.ModelData.ContinueTesting = True
    Statement 2 - based on the response to the message popup (via precondition), loops to reset each TestSocket's ContinueTesting flag:
    RunState.Root.Locals.ModelData.TestSockets[RunState.LoopIndex].ContinueTesting = True
    These two statement steps force the next step to be executed in the Batch Process Model to be the first step in the "Setup" step group, and reset all necessary flags for the batch itself and the individual TestSockets. I discovered the flags that had to be reset by trial-and-error (that was the time-consuming part).
    You can run continuous batches of the same size you first chose (for as long as you like), but when stop the batch execution this new message popup will prompt (yes/no) whether you want to continue testing with a new batch size. If no, then processing terminates. If yes, then the next two statement steps are run and execution resumes back at the beginning of the Batch Process Model's Setup step group. This forces the ModelOptions callback to be executed again, so your VI (in my example here it's just a Message Popop) can then set NumTestSockets appropriately.
    Thanks for contacting National Instruments!
    David Mc.
    NI Applications Engineering
    Attachments:
    kumar.seq ‏27 KB

  • Java.rmi.ConnectException on calling callback method

    I have an interface exposed as a remote service with a simple method to register the callback object on wich the server calls a method to notify an event.
    public void registerForNotification (ExitCodeCallback callback) throws RemoteException;
    public interface ExitCodeCallback extends Remote
       * @param event
       * @throws RemoteException
      public void notifyExitCode (ExitCodeEvent event) throws RemoteException;
    public class ExitCodeEvent implements Serializable
       * Comment for <code>serialVersionUID</code>
      private static final long serialVersionUID = -8542839971016423057L;
      private Integer code;
      private String sourceName;
       * @param source
       * @param exitCode
      public ExitCodeEvent (String source, Integer exitCode)
        exitCode = code;
        sourceName = source;
       * @return Object
      public Object asString ()
        return sourceName + " exited with code " + code;
    }When the server try to call this method causes an exception to be thrown
    java.rmi.ConnectException: Connection refused to host: 26.2.242.76; nested exception is:
         java.net.ConnectException: Connection refused: connect
         at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:574)
         at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
         at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:94)
         at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:179)
         at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
         at $Proxy2.notifyExitCode(Unknown Source)
         at it.sogei.jscheduler.rmi.server.SchedulerServicesServerSide$InnerServerExitCodeCallback.notifyExitCode(SchedulerServicesServerSide.java:156)
         at it.sogei.jscheduler.rmi.server.ApplicationTask.notifyExitCode(ApplicationTask.java:129)
         at it.sogei.jscheduler.rmi.server.WaiterThread.run(WaiterThread.java:47)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: java.net.ConnectException: Connection refused: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
         at java.net.Socket.connect(Socket.java:516)
         at java.net.Socket.connect(Socket.java:466)
         at java.net.Socket.<init>(Socket.java:366)
         at java.net.Socket.<init>(Socket.java:179)
         at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
         at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
         at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
         ... 10 morebut, surprisingly, the client receives the event even if the ExitCodeEvent.asString() called on that object print the following line
    null exited with code null.
    I wonder how this could be happened?

    - It happens every single time the callback method is invoked, I see the event been deserialized client-side with the fields initialized with null values and server-side there is the java.rmi.ConnectException.
    - The client can't unexport the callback object, that's because I didn't think to do it.
    this is the method where I start to notify to all the registered client the event
    for (ExitCodeCallback callbackElement : callback)
            try
              callbackElement.notifyExitCode(event);
            catch (RemoteException ex)
              logger.debug("Unable to notify.", ex);
          }where
    List<ExitCodeCallback> callback;and implementation of the callback interface is
    public class ClientExitCodeCallback implements ExitCodeCallback
      transient Logger logger = Logger.getLogger(ClientExitCodeCallback.class);
       * @see it.sogei.jscheduler.ExitCodeCallback#notifyExitCode()
      public void notifyExitCode (ExitCodeEvent event) throws RemoteException
        logger.warn(event.asString());
    }

  • RMI Callbacks & Firewalls

    I am developing a java application where the client initiates a request to the server, then passes a remote object to the server, so that the server may do call backs.
    the problem is that the client is behind a firewall, and thusly when the server attempts to create a connection back to the client it fails.
    is it possible to have the client call back go through the existing socket, rather than creating a new one?
    the existing socket is the one the client opened to the server to connect in the first place?
    I have seen third party apps(rmi doves, rmiproxy) but i am wondering if this can be implemented easily with out the use of third party software?
    Thanks,
    dan

    Hi Dan,
    There are very easy ways to do this, and very complicated, depending on how many users your expecting. If the number is not too large, (<1000 or so) here is, quite likely, the very simplest method:
    Have clients call a getData method on the server object, it would be implemented something like this: public synchronized Data getData() {
       wait();
       return data;
    }Now clients would create a separate thread to call this function, since it will block until there is a callback from the server.
    Next the server object has a corresponding internal method:synchronized void setData(Data data) {
       this.data = data;
       notifyAll();
    }This will cause all blocked clients to return with the callback data via their outbound socket. When the thread is finished processing the callback functionality, it simply calls getData again.
    This is fast, simple, and easy; its problem is its potential to create a large number of blocked threads at the server. These do not consume a lot of compute cycles, but definitely memory.
    If you would like some other options, I host a free project for simple yet powerful RMI interoperation, at java.net:
    https://cajo.dev.java.net
    It should give you even more ideas!
    Good luck,
    John

  • NAPT Firewall, RMI Callbacks and JRMP MultiplexProtocol

    Hi All,
    I am looking at having an RMI client behind a Network Address Port Translation firewall receive RMI calls back from an RMI server. NAPT makes it impossible for the client to listen for connection coming from the server through the NAPT firewall.
    This is discussed at http://www.rmiproxy.com and http://cssassociates.com/rmifirewall.html but the proposed solutions do not appear to use the MultiplexProtocol protocol defined by JRMP (http://java.sun.com/j2se/1.4.2/docs/guide/rmi/spec/rmi-protocol3.html).
    The RMI FAQ
    "How can I receive incoming RMI calls through a local firewall"?
    (http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html#firewallIn) had a section for JSSE 1.3 that explained how to use the multiplex protocol (option 4). It sounds like this option referred to the JRMP MultiplexProtocol protocol.
    The multiplex protocol option has been removed from the 1.4 FAQ
    (http://java.sun.com/j2se/1.4.2/docs/guide/rmi/faq.html#firewallIn).
    Tried the "checkListen" and "socket factory" techniques mentioned in the 1.3 FAQ without success with 1.4.2. The RMI client behind the NAPT firewall runs in a signed Applet.
    Is the ability of using the JRMP MultiplexProtocol protocol available in the JRE in order to receive incoming RMI calls through a local firewall? If yes, what do you do in order to use it?
    What is the best way to have RMI callbacks work behind NAPT?
    Thanks a lot in advance!
    Cheers
    Bertrand

    As of about JDK 1.2.2, the ability of RMI clients to negotiate the multiplex protocol was
    removed, but the server-side support remains.
    Your best answer for negotiating NAT filrewalls may be the RMI Proxy http://www.rmiproxy.com, although I could be biased as I wrote it.
    EJP

  • Disable a test socket during execution (Batch Mode)

         We are running a Batch Model with Batch Synchronization.   I am wondering if it is at all possible to totally disable one or more of the test socket during execution.  I know that the opening screen allows you to choose which sockets are active, but in the event that something goes astray like the RS-485 communication is non-responsive, I would like to disable one or more at anytime during the test.  Thank you in advance for any ideas you come up with.
    Regards
    Scott
    Environment: TestStand 2010
    Solved!
    Go to Solution.

    I am not aware of how to stop a socket which is already running and facing an error midway.
    But this setting will ensure that the socket is disabled for the next runs.
    1) Override the preBatch callback.
    2) Call this statement in the current executing thread to stop the socket from next run. ( precondition = on error)
    RunState.Caller.Parameters.ModelData.TestSockets[RunState.TestSockets.MyIndex].Disabled=True

  • AS3/Sockets: more than 100 ms between ProgressEvent.SOCKET_DATA events?

    Hello,
    I'm sending images from a server, in C-berkeley sockets, to a Flash client, both on the same Linux machine:
    Average size of each package: 35000 bytes.
    Flash requests an image, and the server sends it.
    Server spends 30 ms to get,compress and send the image.
    OpenCV is used to grab each frame from a webcam.
    On Flash, first frames are received in time, every 60 ms but then the elapsed time between two reception events (ProgressEvent.SOCKET_DATA is 170 ms. So it displays images with a low frame rate.
    The visualization is not smooth but blurred.
    Anyway, the server never waits more than 40 ms to get a client's request, this is what I measure at least..., so is either Flash or server "lying" to me?
    If I connect the same Flash to a "as3-server" (OpenKinect server which gets images from the Microsoft's Kinect), everything is OK.
    Maybe there is some issue on the server side but I'm using a dedicated one with the classical functions (bind, accept, read, write and close). Any thoughts?
    Regards.

    I'm experiencing the same issue.
    I'm sending images from a C# server to an AS3 client.
    Everything is fine, with a transfert time of around 30ms per image.
    Then, for no apparent reason images take 300 or 600 or more time to get to the client.
    Then, after even some more time, it fixes itself and goes back to 30ms.
    - When everything is fine, SOCKET_DATA events contain about 24820 bytes each. (images themselves are 1 to 8MB).
    - When the problem occurs, SOCKET_DATA events contain 65636 bytes each, with occasionally lower values.
    - It is only some SOCKET_DATA events that takes long to be called back, generally one or two per image sent.
    I have series like this:
    (normal)
    socket.bytesAvailable: 24820 bytes. Inactive for 0ms.
    socket.bytesAvailable: 24820 bytes. Inactive for 0ms.
    socket.bytesAvailable: 24820 bytes. Inactive for 0ms.
    (slow)
    socket.bytesAvailable: 65536 bytes. Inactive for 0ms.
    socket.bytesAvailable: 25996 bytes. Inactive for 0ms.
    socket.bytesAvailable: 6944 bytes. Inactive for 297ms.
    socket.bytesAvailable: 65536 bytes. Inactive for 0ms.
    socket.bytesAvailable: 65536 bytes. Inactive for 0ms.
    socket.bytesAvailable: 11104 bytes. Inactive for 0ms.
    socket.bytesAvailable: 6944 bytes. Inactive for 273ms.
    socket.bytesAvailable: 65536 bytes. Inactive for 0ms.
    Where "Inactive" is the ammount of time spent between SOCKET_DATA callbacks, outside of my code.
    Some packets just take super long to be reconstructed into the byte array and sent to me in the socket data event.
    It looks like this happen after a buffer underflow.
    I have verified that this behavior is not due to Flash rendering (same problem if I don't display the images or don't do anything else).
    Currently my only viable workaround is to detect these long transferts and force a disconnection and reconnection.
    Anyone has experienced this and found a better solution or explanation ?

  • Not getting callbacks for X509TrustManager

    hi,
    We have an applet trying to connect to server over SSL. Its socket communication. Here i m trying to make the applet open SSL conneciton with server.
    the applet is trying to connect to the server over a Fully qualified domain name whose ip is resolved via hosts file. I gave implementation of the X509TrustManager and added it to SSLContext. HOw ever i dont see any call back during the SSL hand shake. I verified this using debug point in eclipse.
    the code is as follows
         static {
              try {
                   TrustManager[] setupTrustManager=new TrustManager[]{new *DevTrustManager*()};
                   SSLContext sslContext = SSLContext.getInstance("TLSv1");
                   KeyStore emptyKeyStore = KeyStore.getInstance("JKS");
                   emptyKeyStore.load(null);
                   KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509", "SunJSSE");
                   keyManagerFactory.init(emptyKeyStore,null);
                   sslContext.init(keyManagerFactory.getKeyManagers(), setupTrustManager, new java.security.SecureRandom());
                   factory = sslContext.getSocketFactory();
              } catch (Exception e) {
                   e.printStackTrace();
         public static void main(String[] argv){
              SSLSocket socket = connectSocket("connservice123.company.co.in", 2147, 0);
              if(socket!=null){
                   System.out.println("conn established...\n" + socket.isConnected());
    DevTrustManager
    DevTrustManager implements X509TrustManager() {
                   public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                        System.out.println("33333333333");
                        return null;
                   public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
                        System.out.println("1111111111111");
                   public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
                        System.out.println("222222222222");
    When i run the above i get the below SOP:
    conn established...
    true
    Any ideas why the DevTrustManager methods are not getting the callback. The class is a dummy implementation of X509TrustManager with SOPS in it.

    user480471 wrote:
    We are with proper impl of SSL itself with additional checks like check the CA (to be our own CA) who is verifying the public cert of the server; verify the CN and DNS names of the public certificate etc...Not with that code. That code will accept anything. Chuck it away. If you want to check the certificates further you should be using a HandshakeCompletedListener, not a TrustManager.
    //gets the ssl socket and connects to it
    connectSocket(String host, int port){
    factory.getSocket(host, port);
    }This is not correct. There is no getSocket() method in SSLSocketFactory. Did you mean createSocket()?
    Any help? Do we have any proper tutorial over net to get my requirement runnning?There is only the JSSE Reference Guide. But you're not doing this the right way. Just use your truststore to control what server certificate signers you will trust, then check the actual server certificate recieved in a HandshakeCompletedListener. It is much simpler than what you're trying to do.

  • How can I set the number of test sockets in my program?

    How can I set the number of test sockets in my program? I use LabWindows/CVI  6 and TestStand version 2.0.
    And I use BatchModel for the parallel UUT running. I didn't found program way to set the number of test socket. I think I should have it. In TestStand I can change the number of test sockets through menu Configure -> Model Options -> number of test sockets (I mean I do it by manual mode).
    Thank's a lot.
    Maria

    One way you can set the number of Test Sockets for your sequence is by overiding the ModelOptions Callback used by your sequence. Select All Sequences from the View drop-down then right click, select Sequence File Callbacks, select the ModelOptions callback and then click on Add. You can then select the Edit button to Edit the ModelOptions for your sequence. You can set other ModelOptions as required also.
    RG

  • CallBack from Oracle to a bean

    I am using WL5.1 and Oracle 8i.
    My application demands clients to be refereshed whenever a table in the
    database is modified.
    For this, I plan to load Java class inside Oracle 8i wrap it inside a
    procedure, which will be invoked on the table update.I was able to do
    the basics and test it also.
    But, I am unable to call the EJB Bean deployed in
    the WL.
    Here is part of the Java class loaded in Oracle 8i
    static public Context getInitialContext() throws Exception
    Hashtable h = new Hashtable();
    h.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    h.put(Context.PROVIDER_URL, url);
    if (user != null) {
    System.out.println ("user: " + user);
    h.put(Context.SECURITY_PRINCIPAL, user);
    if (password == null)
    password = "";
    h.put(Context.SECURITY_CREDENTIALS, password);
    return new InitialContext(h);
    I get an error
    Cannot instantiate class: weblogic.jndi.WLInitialContextFactory.
    what can be the problem, is it that it's not possible to
    call a external program from within Oracle Server.Oracle documentation
    doesn't talk about it clearly.
    Can anybody help me out or give me a better idea of how to do callbacks.
    Thanks!
    Sandip

    Yes i restarted. Here my file contains.
    Can you pls check, did I done mistake on these files
    listener.ora*
    -bash-3.00$ cat listener.ora
    # LISTENER.ORA Network Configuration File: /oracle/ora_9/network/admin/listener.ora
    # Generated by Oracle configuration tools.
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dr-atm)(PORT = 1521))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /oracle/ora_9)
    (PROGRAM = extproc)
    (SID_DESC =
    (GLOBAL_DBNAME = orasql)
    (ORACLE_HOME = /oracle/ora_9)
    (SID_NAME = orasql)
    (SID_DESC =
    (PROGRAM = hsodbc)
    (ORACLE_HOME = /oracle/ora_9)
    (SID_NAME = myodbc5)
    (ENVS=LD_LIBRARY_PATH = /usr/local/lib:/oracle/ora_9/lib)
    tnsnames.ora_
    # TNSNAMES.ORA Network Configuration File: /oracle/ora_9/network/admin/tnsnames.ora
    # Generated by Oracle configuration tools.
    ORASQL =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dr-atm)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = orasql)
    INST1_HTTP =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dr-atm)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = SHARED)
    (SERVICE_NAME = MODOSE)
    (PRESENTATION = http://HRService)
    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
    (CONNECT_DATA =
    (SID = PLSExtProc)
    (PRESENTATION = RO)
    HSODBC =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS =
    (PROTOCOL = TCP)
    (HOST = dr-atm)
    (PORT = 1521)
    (CONNECT_DATA =
    (SID= myodbc5)
    (HS=OK)
    odbc.ini_
    [myodbc5]
    Driver = /opt/mysql/myodbc5/lib/libmyodbc5.so
    Description = MySQL ODBC 3.51 Driver DSN
    SERVER = 192.168.2.244
    PORT = 3306
    USER = jagath
    Password =
    Database = test
    OPTION = 3
    SOCKET =
    [Default]
    Driver = /usr/local/lib/libmyodbc3.so
    Description = MySQL ODBC 3.51 Driver DSN
    SERVER = localhost
    PORT =
    USER = root
    Password =
    Database = test
    OPTION = 3
    SOCKET =

  • Parse streaming XML over a socket

    Is it possible to parse XML incrementally over a socket connection? I would like to parse and respond dyanamically to streaming XML and I am looking for some direction. Everything that I have read so far with respect to parsing XML from files. Thanks in advance

    You will want to look into a SAX parser, they are specifically intended for parsing xml over an input stream. They call callbacks to handle each element that arrives from the socket.
    However, there are a lot of posts about the sax parsers hanging, and I just posted last week trying to find the cause/solution. I've seen a number of solutions posted, but none have worked in my case. No replies to my post yet.
    Steve

  • RMI, NAT firewall, and callbacks

    Hi,
    My problem is similar to many other problems that have been posted over the span of nearly a decade on this forum. However, I'm starting this thread because my search through the forum didn't make me happy, and because I hope that with new versions of Java new things might be possible.
    My setting: the server has a public IP, a client is behind a NAT firewall. The client passes a Remote object to the server so that the server can call back the client some time later. This setting is nowadays very common in Internet: clients are run on ubiquitous home routers with NAT, and servers are available on public IP addresses.
    One way to solve this problem is to instruct the server to use the TCP connection already established by the client when the server wants to call back the client. This way the NAT firewall will not block the server communication, because it will be part of the connection initiated by the client. So it looks like using a socket factory might be a solution.
    Is the solution with socket factories possible?
    Thanks,
    Irek
    Edited by: 893951 on 2011-10-31 04:44
    Edited by: 893951 on 2011-10-31 04:52

    EJP wrote:
    the seconds one fails.Fails how?Well, the server can´t connect to client. That is, i have a server in 193.136.205.20 a a client in 193.136.205.20 (same host). The client connects to server and the server callback the client. I have another client in 193.136.205.128 and it connects do server too, but when the server callback this client, i have the exception "No connection to route host".
    Is it because of firewall?Impossible to say until you tell us how it fails.
    If i kill the firewall in both server and clients, does it work?I don't know, it's your firewall. Does it?
    Or is there any solution, making the client as a server?A callback is a server.Yes, i understood that. I have expressed myself in a bad way. A callback is a server indeed. When i create the client callback object, i export it, creating the object and in the login method (existent in server) i send this object so the server adds it to a hashtable to callback later.
    >
    It sounds like a strange design. How come the client has the datase?, not the server? and why can't the client just push the database updates to the server? How can the server know when to callback the client to get more updates?Well, i have a local database for each client and a large database in server. I said the clients fetch database just as a example. The real deal is that a client fetches values from devices that measure energy values (electricity, gas, water, temperature, etc...). It fetches all connected devices in 5 minutes interval and saves values in the local database. 3 minutes after that synchronize, the server fetches all connected clients for all values from all proxys (clients). This is done using callback. It´s why i have this design. I thought on pushing values to the server. And it´s an idea that could be implemented. But this is how my company wants this testing project implemented...
    However i have managed to correct this error. I have tried with another host 193.136.205.106 and it connected to server and the server could callback it. I then assumed that the host 193.136.205.128 had firewall permission problems. I solved this, creating the server registry in port 1099 and fixed the object port to 2000. Then, everytime i create a client, i fixed the export callback object in port 2004. I have set the permissions in both firewalls (server and clients) to accept connections in por 1099, 2000 and 2004 and it functions all correctly!! =)
    Thanks for the help.

Maybe you are looking for

  • File in filesystem locked for deletion

    Hi, I have a problem with the deletion of a file from the filesystem. I have created a file with: File file = new File("download.csv"); then fill the file through a RFC call to the backend and a third party CSV Writer. Finally I want to transform the

  • Moving from jdk1.3 to jdk1.4

    Hi everybody, I need one info. There is a bug in JDK1.3 related with HTTPClasses and Sun Says it has been fixed in JDK1.4. So i want to move to JDK1.4 . NOW what are the possible problems . My application uses Swing , XML ( xalan parser) . Can someon

  • Any reason my mac air didn't come with iphoto or garage band?

    Aren't macs supposed to come with iphoto, imovie, garage band?

  • Annoucing a few complimentary copies of Sun Web Server: Essentials Guide

    Dear Sun Web Server user, As you may have heard, found it on amazon.com or stumbled on it in the local book store like Borders or Barnes & Noble, there is a new book on Sun Web Server technology. If you haven't, no worries. Please refer to [t-5406033

  • What is a routine

    Dear all, I want to create MRP based pricing. In MRP based pricing all calculations are done by backward.For that i have to develop one formula which contains Multiplication & division, so for that i have to develop routine, how we define routine? Is