if u build on linux, u can get data from rs232 and store in buffer. then u can send this data via socket. u can finish all these under userspace, if u need high performance, u can finish it under kernel space.
no data format exchange needed. the intermediate form is a data buffer.