# Raw socket answer (non-http request reply)

**URL:** <https://www.ruby-forum.com/t/raw-socket-answer-non-http-request-reply/243168>\
**Category:** NGINX\
**Created:** [August 28, 2015, 11:04am UTC](https://www.ruby-forum.com/t/raw-socket-answer-non-http-request-reply/243168 "2015-08-28T11:04:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [August 28, 2015, 11:04am UTC](https://www.ruby-forum.com/t/raw-socket-answer-non-http-request-reply/243168/1 "2015-08-28T11:04:34Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Ilja\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/e56c9b/32.png) [@Ilja\_R](https://www.ruby-forum.com/u/Ilja_R)\
**Post date:** [August 28, 2015, 1:41pm UTC](https://www.ruby-forum.com/t/raw-socket-answer-non-http-request-reply/243168/2 "2015-08-28T13:41:42Z")

</div>

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
