How do I send a raw TCP request from jenkins pipeline?

17 views
Skip to first unread message

red 888

unread,
Aug 30, 2018, 9:24:03 AM8/30/18
to Jenkins Users
There is the excellent "httpRequest" I can use in a pipeline build step.

But now I want to send a raw TCP request, I could not find a plugin for this. Is there a supported plugin feature for this? I want to avoid shelling out for this.

This is an example of the raw TCP request I am making:

echo 'abc123 blahblahblah' | nc public.endpoint.com 10514

I the endpoint supports tls so I'd like to use that for the connection too.

If there is no plugin is it possible to write a groovy class in "src" folder that uses the Java tcp client to esblish a tls connection and send messages?

Mandy Hubbard

unread,
Aug 31, 2018, 12:28:54 PM8/31/18
to Jenkins Users
You should be able to put that in an sh (scripted) or script (declarative).  For example:

sh '''
             echo 'abc123 blahblahblah' | nc public.endpoint.com 10514
'''
Reply all
Reply to author
Forward
0 new messages