membersound
membersound

Reputation: 86637

How to configure Spring to take a data from socket bytestream?

I'm trying to configure Spring on the server side to open a socket, listen for connections and take the incoming stream (converting to String).

But I cannot find any working examples on how to just create such an incoming tcp connection. This is what I have (taken from an incomplete example):

<int-ip:tcp-connection-factory id="cfServer"
    type="server"
    port="8080"
    using-nio="true"
    single-use="true" />

<int-ip:tcp-inbound-channel-adapter id="inboundServer"
    channel="loop"
    connection-factory="server"/>

<int:channel id="loop"/>

Well, but how do I continue? How can I acutally bind these adapters to a backing class? And what do these classes have to look like?

Upvotes: 1

Views: 1129

Answers (1)

Gary Russell
Gary Russell

Reputation: 174494

Subscribe something to the loop channel, e.g. a <service-activator/>.

See the tcp-client-server sample

Upvotes: 3

Related Questions