If you use a module with read() and write() functions, use the buffers that each functions has. Example: when you write to the module, the read() function is called. read() stores the received data in your buffer. Don't create and allocate variables, tranfer your data through buffers. If you have questions, please send e-mail.