Does anyone have any experience of the easiest way of doing this or other suggestions or sample code?
The easiest way to do this depends on your knowledge in this field. Using the HTTP protocol has the advantage that you can test your server part with your every day web browser. The chat server example is more like the equivalent serial protocol version, so if you have experience with designing and parsing serial protocols, that's the better way to go.
The UDP version suggest by Krodal doesn't give you much benefit in this context. UDP uses less network resources but the use case you describe produces such a small amount of network traffic that the additional complexity and the fewer tutorials available probably don't pay off.