# Re: how to properly format data when using TCPSocket.send()

**URL:** <https://www.ruby-forum.com/t/re-how-to-properly-format-data-when-using-tcpsocket-send/80687>\
**Category:** Ruby\
**Created:** [December 29, 2006, 11:28pm UTC](https://www.ruby-forum.com/t/re-how-to-properly-format-data-when-using-tcpsocket-send/80687 "2006-12-29T23:28:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gennady\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c57346/32.png) [@Gennady\_B](https://www.ruby-forum.com/u/Gennady_B)\
**Post date:** [December 29, 2006, 11:28pm UTC](https://www.ruby-forum.com/t/re-how-to-properly-format-data-when-using-tcpsocket-send/80687/1 "2006-12-29T23:28:10Z")

</div>

Rob M. wrote:

> > http\_socket = TCPSocket.new("#{i}", 80); http\_socket.send("PUT
> 
> nc -l -k 3001
> 
> …will start your ‘server’. Then you set your client to connect to  
> localhost 3001, you can use nc as a client to test that as well:
> 
> echo hello | nc localhost 3001

Thanks for mentioning nc, did not know that such a utility exists.  
However, it worth mentioning that it is only BSD/Linux thingy (by  
default), on Solaris here’s what it is 😉 :

User Commands nc(1)

$ man nc

NAME  
nc - Client program for NEdit text editor

SYNOPSYS  
nc [-read] [-create] [-line n | +n] [-do command] [-[no]ask]  
[-svrname name] [file…]

DESCRIPTION  
nc is the client interface to the NEdit text editor. To use  
…

Gennady.

---

<div class="post-metadata">

**Author:** ![Gennady\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c57346/32.png) [@Gennady\_B](https://www.ruby-forum.com/u/Gennady_B)\
**Post date:** [December 30, 2006, 11:35am UTC](https://www.ruby-forum.com/t/re-how-to-properly-format-data-when-using-tcpsocket-send/80687/2 "2006-12-30T11:35:38Z")

</div>

Gennady B. wrote:

> [snip]  
> Thanks for mentioning nc, did not know that such a utility exists.  
> However, it worth mentioning that it is only BSD/Linux thingy (by  
> default), on Solaris here’s what it is 😉 :

[http://netcat.sourceforge.net/](http://netcat.sourceforge.net/) might help.
