determining a socket's file descriptor integer value
Wed Apr 28 05:29:49 CEST 2010
When a socket is opened is it possible to get any information about its file descriptor?
I have an Erlang proxy server that accepts incoming HTTP connections, determines an appropriate backend server, opens a socket to that server and then proxies the HTTP request and response data between the backend server socket and the accepted client socket. I'm curious if I can accept the client socket in Erlang and then pass it to a NIF along with the ip and port of the backend server and do the actual proxying of data in C. Is that crazy talk? If I could determine the integer value of the client socket file descriptor that would be enough information to read and write from/to that socket in the C code, right?
The Erlang socket is a tcp_inet port driver from what I can tell. Is there some way to query it for the information I'm looking for?
More information about the erlang-questions