Just any data, or is it a specific device?
You'll want to look at the MSDN documentation for the API calls to check/open/close/read/write the ports. Otherwise, if you know the specific device, there's a good chance there is a library you can use external functions to interface with.