Announcement Announcement Module
No announcement yet.
how can i configure the local adress for a client socket Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • how can i configure the local adress for a client socket

    I'm writing an application on openshift (PAAS by redhat).

    openshift only allows sockets (client or server) to connect to a server-specific ip. i had no problem doing that for a server connection-factory.

    How can i configure a spring-integration tcp-connection-factory in client mode to do that?


  • #2

    Seems there is no enough info...
    Connection Factory can be simply configured for client-mode:
    HTML Code:
    		so-timeout="60000" />


    • #3
      here is my xml config:
      the problem seems to be that the client port uses the wrong host at the SOURCE!

      i believe i have to configure the local address where the connection will originate from.


      • #4
        ... Does not apply to TCP outbound adapters and gateways.
        The host to which a client connection factory will connect.
        So, it doesn't make sence to the server factory.
        I think you have a FireWall issue: it doesn't allow you to connect to specific port.
        Or your client doesn't see server host at all...
        Does telnet work for that?


        • #5
          the server part is running. i can verify that with telnet or with access from a remote client.

          the problem is that the client factory can not open a socket at the source (!) because the underlying openshift mechanism does only allow sockets to be bound to a specific source ip.

          i need to tell the connection factory of the client to set the local address for outgoing connections to that ip.
          initialy i tried local-address but as you posted, this is not used.


          • #6
            What does source mean? You several times point me to it...
            to set the local address for outgoing connections to that ip.
            Do you mean some proxying?
            How about configure that local address to the host property of the client factory?..


            • #7
              my environment has multiple ips but my application is only allowed to use one of them for outgoing connections. if i try to use another one (or java does in this case) i get "permission denied".


              after some research i found that a different way of proxy creation will probably fix my problem.

              i want to do something similar to:
              new Socket(<inetaddress from target host>, 4444,<inetaddress from my specific source ip>,0)

              for spring-integration this probably means i will write a custom TcpSocketFactorySupport to supply my own socket factory

              for the long term it might be better if spring-integration would use
              SocketFactory.createSocket(InetAddress address, int port, InetAddress localAddress, int localPort)
              and pass "local-address" even for client factories.
              Last edited by Laures; Jun 4th, 2013, 07:22 AM.


              • #8
                Yes, as I mentioned on StackOverflow, a custom TcpConnectionSupport with a SocketFactory wrapper should work.

                But feel free to open a JIRA issue.