Raw socket answer (non-http request reply)

i have to handle raw socket connections in simple manner: any
connection to specific port should be served with predefined data
(text string), without http headers, wrappings, etc.

Is it possible to do with nginx? May be there is plugin or something
similar.

To be specific - i wish to serve Adobe socket policy file on 843 port.
It is important, that server should send policy request strictly
“as-is”, without additional content inside raw socket answer

Thanks in advance!

On Fri, Aug 28, 2015 at 12:04:07PM +0300, Ilja R. wrote:

i have to handle raw socket connections in simple manner: any
connection to specific port should be served with predefined data
(text string), without http headers, wrappings, etc.

Is it possible to do with nginx? May be there is plugin or something similar.

To be specific - i wish to serve Adobe socket policy file on 843 port.
It is important, that server should send policy request strictly
“as-is”, without additional content inside raw socket answer

If I understand correctly, you want this:

  • client opens connection, server accepts it
  • client sends nothing
  • server sends a pre-defined file
  • server closes connection

Assuming you have a linux server, simple inetd service is enough.

/etc/inetd.conf:

adobe stream tcp nowait nobody cat /path/to/the/file/to/be/sent

/etc/services:

adobe 843/tcp

Both these files should include the given lines, the … means there are
other lines that should probably be kept.

Not tested, but should work. No nginx needed, it’s an overkill for this.

Moskyto