How to use a fixed client localPort in an RMI communication?

Hi,
I am trying to use a fixed localPort in RMI communication using CustomSocketFactories. When I use a fixed localPort the client program runs fine with a right lookup and correct stub method invocation for first time, but when I run the same program immediately I am getting an exception "java.net.SocketException: errno: 125, error: Address already in use for fd: 9".
I also tried to close the socket of ClientRemoteFactory in my client program in a finally block, still I am getting the same exception. If I run the same program after a few minutes it runs fine.
Bottomline is -- "it is clear that if I use a fixed localPort in my customClientFactory, it will be in use for sometime even after I am done with the stub method".
Is there anyway or a work around to clean the socket after it's use. I can not use an anonymous client port for security reasons, I must have to use a fixed localPort. If anyone has any other ideas or approach, please share with me. Any help is highly appreciated as this is very urgent.
Thanks,
Murthy

I'm not sure that you really want to do this unless you are trying to resolve some firewall issue which might be better resolved another way. For a start this technique will limit you to one RMI call per host at any one time.
However, the API you are looking for is java.net.Socket.setReuseAddress(true), which was introduced in JDK 1.4. You have to do this before the socket is connected, i.e.:
Socket s = new Socket();
s.setReuseAddress(true);
s.bind(new InetSocketAddress(localPort));
s.connect(new InetSocketAddress(remoteHost,remotePort));
EJP

Similar Messages

  • How to use a fixed port for remote assistance in windows 8.1 behind a nat router freebox?

    Hello,
    Before to use remote assistance in windows 8.1, i need to configure my nat router freebox.
    But remote assistance ( msra.exe ) use a dynamique port and never the same.
    How to use a fixed port for remote assistance ini windows 8.1 ?
    And why i can't use easy connect ?
    i read that the router must implement the PNRP protocol. I think it's a propriatary microsoft's protocol unknow on my router.
    Thanks

    Hello,
    Very good. It's a big range ( 255 mini from 49152 )  for a single port but if it's the only one possibility...
    You are very helpfull ( i don't know if it's a good english but you make me very happy )
    Merci beaucoup

  • How to use remote desktop client in mountain lion

    How to use remote desktop client in mountain lion.
    I want to connect my other system(ubuntu) using mac remote desktop client, But i could not locate remote desktop client in moutain lion.

    In Ubuntu 12.xx use Dash to find "Desktop Sharing" and set the preferences, including requiring a password.
    Then in Ubu use System Settings > Network to determine your Ubu machine's IP address, such as 192.168.1.13.
    On the Mountain Lion Mac do Finder > Go > Connect to Server   and enter:  vnc://192.168.1.13  or whatever your IP is.  Enter the password that you used in the Ubu Desktop Sharing setup, when asked.
    On the Ubu machine answer the question that pops up asking for permission to connect.  Your Ubu screen will now show up on the Mac, and you can remote control it.   Here I am running "Octave" (a math program) on the Ubu machine, remotely.
    Works great!  BTW, you can do this from an iPad too, using a VNC client such as Mocha VNC Lite.  You can even run both remotes simultaneously.
    Good luck.

  • How to use sap multi-client in SUP+DOE

    hi guys,
    How to use sap multi-client in SUP+DOE ?
    Anybody know the steps necessary for do this ?

    1. If you want to use same SUP server for all the DOE clients then:
    - you need to download the bundle from SDOE_ESDMA_DESIGN transaction from each client
    - You should deploy the ESDMA bundle multiple times in SUP with different names
    2. If you want to use differnt SUP server for each client in DOE then:
    - you need to download the bundle from SDOE_ESDMA_DESIGN transaction from each client
    - Deploy in each SUP server. It can be same name everywhere.
    Regards,
    Siva.

  • How to use Http test Client  for Java Client Proxy Scenario

    Hi,
    I build a scenario using Java Client Proxy where JSP as my FrontHand.
    Can I know that whether i can use Http Test Client in place of JSP for sending data and getting response back. If yes than how can i implement this ?
    Regards,
    Abhi

    Hi,
    with Http Test Client you post your messages
    directly to the Integration Engine (not using adapter framework)
    so you can use Http Test Client to simulate any message
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • How to use the fixed exchange rate  1009 (global rollout subsidiaries)?

    Hi Experts,
    I am doing currency conversion.My requirement is i need to take fixed exchange rate type of 1009.
    I am handling 16 different types of currencies that to be converted into US$.
    Can anyone help me out how to use the exchange rate(1009) and do the currency conversion?
    Thanks in advance
    Ganesh

    Hi,
    Look here for currency conversion:
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=currency+conversion&adv=false&sortby=cm_rnd_rankvalue
    Cheers!
    Amit

  • How to use crystal report client?

    Hi all,
    In my java application we are using crystal report for generating report. For certain condition we are not in the position to use crystal report server. So, is that any possibility to generate the report without crystal report server? i heared something we can generate the report through by using crystal report client...is that possible?
    Please help me..
    Thanks,
    Shiva

    I did that and i set up a trace file withing the sql.net and i reviewed the file and everything is looking fine for me, there is no error at all.
    i can see his session created when he build new connection and run any query, but if he modified that query, the connection is dropped, still dont get it.
    he used to use before VPN but now he has direct connection.
    i also put this parameter in his tnsname.ora file (RECV_BUF_SIZE=11784)
    there is only one thing strange, when i try to use sqlplus /nolog, i couldnt run the sqlplus, or tnsping and it keeps telling me any orginized program or something like that, i asked him to install the oracle client again, because looks like some libraries not working fine, however he complian the crystal report works fine, so oracle client must work ok, i explained to him it is totally different thing, but he refused to confess.
    so i dont know what else i should do,

  • Jax-RPC Client side: How to use multiple X509 client certs ?

    hi, (excuse me for my english)
    i'm looking for an answer to this question:
    I'm using the JAX-RPC libraries (JWSDP 2.0) for a web services client application in my app server (tomcat 4 under 1.4 Sun JVM) with HTTPS connection. All works fine when i'm using system.Setproperties for keystore and trustore.
    Buk now, I want to use different client SSL keys for the same app to consume the web service (one SSL client key for a group of users).
    Is it possible ?
    i've tried using custom SSLSocketFactory and custom KeyManager but it won't works: when the SSL connection is well established once, i can connect to the app with an invalide client cert ! (it seems SSL connection is in cache and i dont't know how to disable this cache).
    I have read some threads on this problem without answers ! (http://forum.java.sun.com/thread.jspa?forumID=331&threadID=333010 and http://forum.java.sun.com/thread.jspa?forumID=331&threadID=600372)
    Thanks
    Edited by: Buck007 on May 26, 2008 9:14 AM

    I have the same problem. If you find the solution please post it here :)
    thanks

  • How to use sequence in client web proxy.

    Hi,
    I have created a sequence in database.
    And I am using that in EntityImpl as:
    SequenceImpl sequence=new SequenceImpl("Sequence_name",getDBTransaction);
    setAttribute(sequence.getSequenceNumber)
    I will automatically set the attribute with the sequence val.
    But I want to get the sequence value in client web proxy generated through WSDL.
    There I write the same code and imported the files.
    But it is giving me error that:
    java.lang.nullPointException.
    How to access the sequence in client web proxy generated through WSDL.

    Hi,
    expose a method on the ViewObject and make it available to the service interface. In Web Services it does not make sense to create dependencies between a client and the implementation detail of the service.
    Frank

  • How to use standalone java client with an enterprise bean in J2EE 1.4

    Hi All,
    I am have deployed a stateless session bean in Sun's J2EE 1.4 Application Server. i am trying to call the bean using a standalone java client. but the client cannot access the bean.
    The error coming is:
    Jan 21, 2004 7:48:27 PM com.sun.corba.ee.impl.legacy.connection.SocketFactoryCo
    nectionImpl <init>
    WARNING: ORBUTIL.connectFailure
    org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
    at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(
    RBUtilSystemException.java:1739)
    at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(
    RBUtilSystemException.java:1757)
    at com.sun.corba.ee.impl.legacy.connection.SocketFactoryConnectionImpl.
    init>(SocketFactoryConnectionImpl.java:74)
    at com.sun.corba.ee.impl.legacy.connection.SocketFactoryContactInfoImpl
    createConnection(SocketFactoryContactInfoImpl.java:88)
    at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.begi
    Request(CorbaClientRequestDispatcherImpl.java:146)
    at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(Corba
    lientDelegateImpl.java:121)
    at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaCli
    ntDelegateImpl.java:212)
    at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
    at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.jav
    :69)
    at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.ja
    a:58)
    at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:12
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at StatelessSessionClient.main(StatelessSessionClient.java:17)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection re
    used: connect
    at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSoc
    etFactory.java:390)
    at com.sun.corba.ee.impl.legacy.connection.SocketFactoryConnectionImpl.
    init>(SocketFactoryConnectionImpl.java:58)
    ... 10 more
    Caused by: java.net.ConnectException: Connection refused: connect
    at sun.nio.ch.Net.connect(Native Method)
    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:457)
    at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
    at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSoc
    etFactory.java:381)
    ... 11 more
    javax.naming.CommunicationException: Can't find SerialContextProvider
    at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.ja
    a:66)
    at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:12
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at StatelessSessionClient.main(StatelessSessionClient.java:17)
    Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed
    No
    at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(
    RBUtilSystemException.java:1739)
    at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(
    RBUtilSystemException.java:1757)
    at com.sun.corba.ee.impl.legacy.connection.SocketFactoryConnectionImpl.
    init>(SocketFactoryConnectionImpl.java:74)
    at com.sun.corba.ee.impl.legacy.connection.SocketFactoryContactInfoImpl
    createConnection(SocketFactoryContactInfoImpl.java:88)
    at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.begi
    Request(CorbaClientRequestDispatcherImpl.java:146)
    at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(Corba
    lientDelegateImpl.java:121)
    at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaCli
    ntDelegateImpl.java:212)
    at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
    at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.jav
    :69)
    at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.ja
    a:58)
    ... 3 more
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection re
    used: connect
    at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSoc
    etFactory.java:390)
    at com.sun.corba.ee.impl.legacy.connection.SocketFactoryConnectionImpl.
    init>(SocketFactoryConnectionImpl.java:58)
    ... 10 more
    Caused by: java.net.ConnectException: Connection refused: connect
    at sun.nio.ch.Net.connect(Native Method)
    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:457)
    at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
    at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSoc
    etFactory.java:381)
    ... 11 more
    My java client uses the following code to access the bean:
    Hashtable props = new Hashtable();
    String URL="iiop://localhost:3700";
    props.put("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory");
    props.put("java.naming.provider.url", URL) ;
    InitialContext ctx = new InitialContext();
    Object ref = ctx.lookup("ejb/StatelessSessionHome");
    StatelessSessionHome home = (StatelessSessionHome)PortableRemoteObject.narrow(ref,StatelessSessionHome.class);
    StatelessSessionRemote statelessSession = home.create();
    plz help me to locate the error.
    Regards,
    Mohit

    Hi Amol,
    thanks for your suggestion.
    i have deployed the converter application in J2EE1.4 tutorial in Sun AppServer J2EE1.4. the deployment process works smoothly. but accessing the deployed converter bean using standalone client as given in the tutorial gives the following error.
    Caught an unexpected exception!
    javax.naming.NoInitialContextException: Need to specify class name in environmen
    t or system property, or as an applet parameter, or in an application resource f
    ile: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
    40)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
    a:280)
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at ConverterClient.main(ConverterClient.java:14)
    I have set the InitialHost and InitialPort as suggested by you in the client code. the client gets successfully compiled but gives error when executed.
    The client code is:
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.rmi.PortableRemoteObject;
    import java.math.BigDecimal;
    public class ConverterClient {
    public static void main(String[] args) {
    System.setProperty("org.omg.CORBA.ORBInitialHost","localhost");
    System.setProperty("org.omg.CORBA.ORBInitialPort","3700");          
    try {
    Context initial = new InitialContext();
    Object objref = initial.lookup
    ("java:comp/env/ejb/SimpleConverter");
    ConverterHome home =
    (ConverterHome)PortableRemoteObject.narrow(objref,
    ConverterHome.class);
    Converter currencyConverter = home.create();
    BigDecimal param = new BigDecimal ("100.00");
    BigDecimal amount =
    currencyConverter.dollarToYen(param);
    System.out.println(amount);
    amount = currencyConverter.yenToEuro(param);
    System.out.println(amount);
    System.exit(0);
    } catch (Exception ex) {
    System.err.println("Caught an unexpected exception!");
    ex.printStackTrace();
    Please suggest so that i can run the standalone client successfully.
    Regards,
    Mohit Kapoor

  • How to use Tnsping from Client

    Hi !
    I am using Forms 6i on clients side & 10g database on server.
    My application is Multiuser. and want to use tnsping command through client system, but its not working. if any alternative way to ping database from client side having only forms6i runtime installed.
    Thanks !
    Regards!

    As Shahidir has mentioned, you can use tnsping80.exe in c:\orant\bin directory
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com
    [Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

  • How to use BCUSER on client 001 / How to do devlopment work on client 001

    Hi,
    In sneak preview, as far as i know developer key is only available for BCUSER.
    But BCUSER works only on client 000. So how can this user be extended to client 001.
    Inother words working in BI environment on client 001 how can a user do to the development work?
    Any work around or tips?
    Thanks,
    sam

    create BCUSER userid in 001 (txn su01) and copy the same authorizations as in 000. it will work.
    Regards
    Raja

  • How to use pub.sap.client:lockSession?

    I am calling a bapi that creates an order. I found that in order to commit, I must first issue a lockSession call, followed by BAPI, then commit and then releaseSession.
    Where can I find more documentation on pub.sap.client:lockSession?
    Thank you.

    Hi,
    DATA: COMMAND TYPE STRING VALUE 'C:\j2sdk1.4.2_08\bin\java',
    DIR TYPE STRING VALUE D:\eclipse\workspace',
    PARAMETER TYPE STRING VALUE 'Helloworld'. "here the name of your java program
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
    EXPORTING
    APPLICATION = COMMAND
    PARAMETER = PARAMETER
    DEFAULT_DIRECTORY = DIR
    MAXIMIZED =
    MINIMIZED = 'X' "If you need the DOS window to be minimized
    EXCEPTIONS
    CNTL_ERROR = 1
    ERROR_NO_GUI = 2
    BAD_PARAMETER = 3
    FILE_NOT_FOUND = 4
    PATH_NOT_FOUND = 5
    FILE_EXTENSION_UNKNOWN = 6
    ERROR_EXECUTE_FAILED = 7
    OTHERS = 8.
    check this link
    /people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection
    Regards,
    Satish

  • How to use Crossbow Xmesh WSN LabVIEW drivers for downstream communication with motes

    Hello,
    I am trying to use LabVIEW Crossbow Xmesh WSN  driver for downstreaming commands but driver programs are not working.
    I am interested in changing node (Iris mote with MDA300 board) update rate from LabVIEW program running on host PC .
           I have  used  Set node update rate.vi  with  open stream.vi and start stream.vi  in proper sequence and developed a program to change node update rate. When program is run no error is shown but node update rate is not changed.
          Pl suggest what I should I do.
    What is the function of  WSN write VIs (WSN write Raw 1sensor1point). For what type of message this is used. 
    I  want to actuate relay on MDA300 with mote id 2. What VIs (from driver ) I have to use and how to issue command related to it.
    Incase any one can help I will be grateful
    Roop 

    Hi Arjun,
    I am sending you snap shot of VI developed to change node update rate.and also the heirarchy of drivers  VIs used in the program for  better understanding .
    In case you can figure out why the command  message send  is unable to communicate with mote .
    Also for downstream communication with motes the packet format used is described in Moteworks user manual from MiMSic.com
    I think the developer of these drivers can help you  out in solving my problem.
    Thanks
     Roop
    Attachments:
    sreenshot to arjun ni for checking downstream comm.doc ‏288 KB

  • Installing and using the instant client

    Hi, we are having some troubles with understanding how to use the instant client.
    We are using a windows client, connection to our Oracle database via odbc, so we can make some staticstics.
    We used to use the full oracle client 8 install, but when that gave us some troubles, so we wantedto switch to a newer release, and saw that there was an instant client. Thinking that i didnt need to install the full oracle client i downloaded the basic package and the odbc addon.
    I unzipped the two archieves in c:\oracleodbc on a clean computer.
    I added the c:\oracleodbc path to the %path%
    I added TNS_ADMIN system variable pointing to c:\oracleodbc
    i ran the odbc_install.exe program.
    I would now think that i could access the oracle database via odbc without having to install the full oracleclient, but it does not work.
    When i try to add a odbc connection in microsoft odbc manager i get the following error when i choose the oracle odbc driver:
    "The setup routines for the Oracle in instantclient10_2 ODBC driver could not be loaded due to system error code 126"
    When i click ok to that i get a new error window with the title: "Driver's ConfigDSN, ConfigDriver, or ConfigTranslator failed" and the error text:
    "Could not load the setup or translator library"
    I was not planning to use any TNS files, but just use the quickconnect string, to connect to the right oracle service.
    Do i still need to install the full client for it to work or what ?
    Hope someone can help out.
    Thanks in advance.

    I'm replying to an old thread, but did any of you ever got this resolved?
    I've got a fresh Windows 2003 Server install, from which I'd need to establish an ODBC connection to an Oracle database.
    I've downloaded Instant Client Basic and ODBC add-on, unzipped them into D:\oracle\instantclient10_2\ , added the path into PATH, TNS_ADMIN and ORACLE_HOME environment variables and run the odbc_install.exe successfully.
    Trying to create an ODBC connection (System DSN) results in "The setup routines for the Oracle in instantclient10_2 ODBC driver could not be loaded due to system error code 126".
    I don't have MFC71 on the server and I couldn't figure out where to get those - I won't install MS Visual .NET just for this. MFC42 appears to be included in the OS.
    Where can I get an older version of Instant Client instead?

Maybe you are looking for

  • Disk Utility says "no options" when I try to partition

    Hi, I have a flat-screen IMac G4. I want to partition the hard drive. When I open disk utility and click on the drive I want to partition, I get the partition tab, but everything is grayed out and it says "no options." Can anyone tell me how to proce

  • Calculation of po qty based on material in  Reuse_alv_grid_dispay report

    Hi friends, This is the requirement I need to calculate the total Quantity(ekpo-menge) on open stores orders(doc type) with today's delivery date + (today's date + 1). help me out in giving the mandatory fields that need to be taken and  the code to

  • Using console program from java swing

    Can anyone please tell me if the following is possible and how to do it. I want to create a gui for mencoder and so for example i will be wanting toexecute mencoder from the swing app to find out the the auto crop values so i can visually display the

  • Flex 15 touch screen problem

    Can anybody help. Just recently apppeared a problem with touch screen - stoped working. After some awakes from sleep mode - it works unproperly. Restart helping not to awake at all. System 8.1, 64bit, all drivers up-tp-date. Any suggestions?

  • Database access tool for Java Development

    Hi, A couple of days back, our SAP's database (MSSQL) was corrupted and downed the Java Stack.           During the Java development, normally after a newly created table was deployed via Java Dictionary, Java developer will access the database via t