Example ROS publisher, subscriber, server and client for topics, services and actions in C++ an Python. You'll need a working ROS workspace and the corresponding package e.g. hallowelt-kinetic on Ubuntu 16 or hallowelt-melodic for Ubuntu 18.
The usage instructions are explained in my book "Roboter mit ROS" but you should be able to easily try out without it.