I got the handle for the TCP socket as follows:
int desc = accept(socket_descriptor, &client_address, &len)
Now from this desc descriptor I want to get a file pointer. Is it possible to use fdopen() here?
The reason I want to get a pointer to a file is because I am making changes to existing code that writes data to a local file. Now I want to expand my functionality so that it can be written to the TCP client as an alternative. I donโt want to rewrite all the functions and thought about somehow using the existing infrastructure. Existing functions use a file pointer to write to a file. I was wondering if it is possible to make the same function of writing to a TCP stream without any changes.
Ankurvj
source share