Skip to content

Instantly share code, notes, and snippets.

@Mon-Ouie
Created January 24, 2010 18:58
Show Gist options
  • Save Mon-Ouie/285371 to your computer and use it in GitHub Desktop.
Save Mon-Ouie/285371 to your computer and use it in GitHub Desktop.
static VALUE
init_sock(sock, fd)
VALUE sock;
int fd;
{
OpenFile *fp;
MakeOpenFile(sock, fp);
fp->f = rb_fdopen(fd, "rw");
fp->f2 = fp->f; // rb_fdopen(fd, "w");
fp->mode = FMODE_READWRITE;
rb_io_synchronized(fp);
return sock;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment