End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
BasicSocket#close_read
basicsocket.close_read => nil
ext/socket/basicsocket.c
View on GitHub ↗
static VALUE
bsock_close_read(VALUE sock)
{
rb_io_t *fptr;
GetOpenFile(sock, fptr);
shutdown(fptr->fd, 0);
if (!(fptr->mode & FMODE_WRITABLE)) {
return rb_io_close(sock);
}
fptr->mode &= ~FMODE_READABLE;
return Qnil;
}
Disallows further read using shutdown system call.
Example
s1, s2 = UNIXSocket.pair s1.close_read s2.puts #=> Broken pipe (Errno::EPIPE)
See also
.for_fd
#close_write
.do_not_reverse_lookup=
#connect_address
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0