Just use one of the well established OSC libraries. Most of them support OSC over TCP. I use liblo: https://github.com/radarsat1/liblo

Kind regards,
Felix