/* * call-seq: * conn.socket() -> Fixnum * * Returns the socket's file descriptor for this connection. */ static VALUE pgconn_socket(VALUE self) { int sd; if( (sd = PQsocket(get_pgconn(self))) < 0) rb_raise(rb_ePGError, "Can't get socket descriptor"); return INT2NUM(sd); }