From: Kent Sibilev Date: 2006-09-06T01:17:47+09:00 Subject: Re: C socket to Ruby socket ------=_Part_88822_2914205.1157473065277 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 9/5/06, Andre Nathan wrote: > > Hello > > What is the correct way to convert a C socket (int) to a Ruby Socket > object in a C extension? Something like > > int s = socket(...); > VALUE sock = rb_some_func(s); > > In my extension there's a callback function that receives a socket as an > argument, and I'd like to pass that socket as an argument to a ruby > block, so I need to convert it to a Socket object first. > > You probably can call Socket.for_fd using rb_funcall. -- Kent --- http://www.datanoise.com ------=_Part_88822_2914205.1157473065277--