For testing purposes I am sending tcp messages to a local server as follows:
echo -e "some message" | netcat localhost 1234
With netcat installed using brew install netcat
.
This works fine except for that this blocks for quite a long time (about a minute). I tried to use the options "-w 1" for specifying the timeout, but this does not change anything.
The process listening on the other end is a spring-xd tcp source.
Is there any other way of sending a tcp message that does not block as long?
I've not seen such a delay on linux; haven't tried on OS X (it comes with nc
instead).
What is your stream definition? The default tcp source expects data to be terminated with CRLF - e.g telnet localhost 1234
. You need a RAW
decoder for netcat.
EDIT:
I just tested
xd:>stream create foo --definition "tcp --decoder=RAW | log" --deploy
with
$ echo "foo" | nc localhost 1234
and had no problems.