Announcement Announcement Module
Collapse
No announcement yet.
how can i configure the local adress for a client socket Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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?

    Greetings,
    Alexander

  • #2
    Hi!

    Seems there is no enough info...
    Connection Factory can be simply configured for client-mode:
    HTML Code:
    <int-ip:tcp-connection-factory
    		id="ccf"
    		type="client"
    		host="localhost"
    		port="9876"
    		so-timeout="60000" />
    -Artem

    Comment


    • #3
      here is my xml config:

      https://github.com/Laures/openshift-...ket-module.xml
      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.

      Comment


      • #4
        local-address
        ... Does not apply to TCP outbound adapters and gateways.
        host
        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?

        Comment


        • #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.

          Comment


          • #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?..

            Comment


            • #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:
              Code:
              new Socket(<inetaddress from target host>, 4444,<inetaddress from my specific source ip>,0)
              see: http://docs.oracle.com/javase/7/docs...ress,%20int%29

              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
              Code:
              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, 08:22 AM.

              Comment


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

                But feel free to open a JIRA issue.

                Comment

                Working...
                X