Thanks for reply.

I have checked source code for IO.write previously (Socket is
inherited from BasicSocket that is inherited from IO, as i can see).
It's a wrapper over POSIX write() function. And according to POSIX
documentation, write() for sockets is exactly same as send() - just
without flags.

Why do you think write() will help? Maybe i miss something?

Best,
Grigory.

On Wed, Oct 26, 2011 at 11:12 AM, Robert Klemme
<shortcutter / googlemail.com> wrote:
> On Wed, Oct 26, 2011 at 9:01 AM, Grigory Petrov <grigory.v.p / gmail.com> w=
rote:
>> TCP sockets are streams, not messages, so berkeley sockets send()
>> function on some systems may send less data than required. Since Ruby
>> Socket is very thin wrapper over berkeley sockets, AFAIK Socket#send
>> will behave exactly like berkeley sockets send(). So what is the
>> correct way to send a complete message via Ruby TCP sockets? In python
>> it's a special function for that called sendall(). But in Ruby i need
>> to manually write code like that:
>>
>> while (sent =3D sock.send( data, 0 ) < data.length do
>> =A0data =3D data[ sent..-1 ]
>> end
>
> In blocking mode you can simply do
>
> sock.write(data)
>
> Kind regards
>
> robert
>
> --
> remember.guy do |as, often| as.you_can - without end
> http://blog.rubybestpractices.com/
>
>