# Quick sockets question

**URL:** <https://rubytalk.org/t/quick-sockets-question/41608>\
**Category:** ruby-talk\
**Created:** [23 October 2007 15:55 UTC](https://rubytalk.org/t/quick-sockets-question/41608 "2007-10-23T15:55:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vasyl\_Smirnov](https://avatars.discourse-cdn.com/v4/letter/v/ecc23a/32.png) [@Vasyl\_Smirnov](https://rubytalk.org/u/Vasyl_Smirnov)\
**Post date:** [23 October 2007 15:55 UTC](https://rubytalk.org/t/quick-sockets-question/41608/1 "2007-10-23T15:55:03Z")

</div>

Hi,

I wonder if it is sufficient to use read/write methods on a TCP/  
UNIXSocket object if all I need to do is just send  
the data to and fro?

Does it handle partial reads/write situations internally?

As far as I understand, recvfrom is necessary when you need some  
specific stuff, like out-of-band data?

Confused, because Pickaxe examples use recvfrom(), and not read().

Can someone explain?

Thanks.

---

<div class="post-metadata">

**Author:** ![Robert\_K1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/robert_k1/32/1830_2.png) [@Robert\_K1](https://rubytalk.org/u/Robert_K1)\
**Post date:** [24 October 2007 08:50 UTC](https://rubytalk.org/t/quick-sockets-question/41608/2 "2007-10-24T08:50:23Z")

</div>

Off the top of my head I believe #recvfrom is for UDP while you want  
to do TCP. And yes, #write and #read should be sufficient.

Kind regards

robert

> **···**
>
> 2007/10/23, Vasyl Smirnov \<vasyl.smirnov@gmail.com\>:
> 
> > Hi,
> > 
> > I wonder if it is sufficient to use read/write methods on a TCP/  
> > UNIXSocket object if all I need to do is just send  
> > the data to and fro?
> > 
> > Does it handle partial reads/write situations internally?
> > 
> > As far as I understand, recvfrom is necessary when you need some  
> > specific stuff, like out-of-band data?
> > 
> > Confused, because Pickaxe examples use recvfrom(), and not read().
> > 
> > Can someone explain?
