Java 如何发送TCP请求的回复(spring集成)?
我需要类似的东西 但是对于TCP。因此,客户端发送消息,TCP服务器可以像OK一样发送回响应。对于TCP套接字表达式=“@inbound.socket”和目标表达式=“headers['ip_packetAddress']”,不能使用 这就是我的配置现在的样子:Java 如何发送TCP请求的回复(spring集成)?,java,spring,sockets,tcp,spring-integration,Java,Spring,Sockets,Tcp,Spring Integration,我需要类似的东西 但是对于TCP。因此,客户端发送消息,TCP服务器可以像OK一样发送回响应。对于TCP套接字表达式=“@inbound.socket”和目标表达式=“headers['ip_packetAddress']”,不能使用 这就是我的配置现在的样子: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:x
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-ip="http://www.springframework.org/schema/integration/ip"
xmlns:int-event="http://www.springframework.org/schema/integration/ip"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd">
<int:channel id="tcpSend"/>
<int-ip:tcp-connection-factory id="client" type="client"/>
<int-ip:tcp-connection-factory id="server" type="server" host="localhost" port="1234"/>
<int-ip:tcp-outbound-channel-adapter id="tcpOutbound" channel="tcpSend"
connection-factory="client"/>
<int-ip:tcp-inbound-channel-adapter id="tcpInbound" channel="tcpReceive"
connection-factory="server"/>
<int:service-activator id="tcpHandler" input-channel="tcpReceive" output-channel="tcpSend"
ref="listener"/>
</beans>
在TCP的情况下,它更容易,因为您可以使用 有关该事项的示例位于官方存储库中: