When a program is started via FastCGI, it is exec'd with a socket already open to talk to the web server. The socket's file descriptor number is handed to the program, but how can that be converted to something useful in Java, such as a Socket instance?
My hosting service uses mod_fastcgi for Apache httpd. They won't allow me to configure an external server where I provide a host:port to forward requests to via FastCgiExternalServer.
You can't do this legally. However, you can do a hack like this (Don't try this at home). You can read from
is
and write toos
.What would you want a
Socket
for? The only useful methods in a socket are getInputStream and getOutputStream but if you’re running as a CGI you already have those: they’re called System.in and System.out. :)