No problem, you're welcome!

On Wed, Dec 11, 2013 at 4:42 PM, Pramod Sharma <[email protected]> wrote:
> Yes. just "uv_read2_start" and it works.
> Thank you very much for your time. Let me play around with this stuff now.
>
>
> On Wednesday, 11 December 2013 17:52:38 UTC+5:30, Fedor Indutny wrote:
>>
>> Ok, so you just need to use `uv_read_start` instead of reading from fd
>> directly :) Seems to be working fine this way.
>>
>> On Wed, Dec 11, 2013 at 4:18 PM, Fedor Indutny <[email protected]> wrote:
>> > Yeah, I was just going to let you know that it seems to be working
>> > fine without libuv:
>> > https://gist.github.com/indutny/b4b02dd2729fd5b9f96d
>> >
>> > Looking into it.
>> >
>> > On Wed, Dec 11, 2013 at 4:14 PM, Pramod Sharma <[email protected]>
>> > wrote:
>> >> And here is the news on uv_server.c - read2_cb if I just change it to
>> >> static void read2_cb(uv_pipe_t* handle,ssize_t nread, uv_buf_t buf,
>> >> uv_handle_type pending) {
>> >>  int r;
>> >>  char buffer[1024] = {0};
>> >>       printf("read2cb callback for handle type %d\n", pending);
>> >>  r = read(self.uv_client_pipe.accepted_fd, buffer, 1024);
>> >>  printf("handle accepted by client  fd = %d, bytes = %d , content are
>> >> %s\n",
>> >> self.uv_client_pipe.accepted_fd, r, buffer);
>> >> }
>> >>
>> >> It is reading the right contents of the xyz file and credential passing
>> >> is
>> >> working ....but is this right ???
>> >>
>> >>
>> >> On Wednesday, 11 December 2013 17:01:28 UTC+5:30, Pramod Sharma wrote:
>> >>>
>> >>> Oh man, yes you are right read2_cb is getting called but with pending
>> >>> as
>> >>> UV_UNKNOWN_HANDLE.
>> >>> So we cant wrap arbitrary file descriptor/handle ??
>> >>>
>> >>> The code will look too clumsy if I try to mix libuv and "credential
>> >>> passing" using sendmsg and recvmsg outside of libuv.  Or may be I can
>> >>> add
>> >>> libuv call to pass arbitray handle itself after understanding the
>> >>> libuv
>> >>> code.
>> >>> What do you suggest ?
>> >>>
>> >>> On Wednesday, 11 December 2013 16:51:19 UTC+5:30, Pramod Sharma wrote:
>> >>>>
>> >>>> Thanks Fedor for quick response and looking into it.
>> >>>> Tried "uv_buf = uv_buf_init(...)".
>> >>>>
>> >>>> About sending arbitrary descriptor as per "Ben's" first comment if we
>> >>>> just wrap it over named pipe/tcp it should work, which is happening
>> >>>> in  my
>> >>>> case as write2 is passing but on the server side read2_cb is not
>> >>>> invoked
>> >>>> immediately on connection close(which is client process exit, which
>> >>>> is
>> >>>> obvious I guess).
>> >>>>
>> >>>>
>> >>>> On Wednesday, 11 December 2013 16:21:21 UTC+5:30, Fedor Indutny
>> >>>> wrote:
>> >>>>>
>> >>>>> Gosh, spent a lot of time figuring it out :)
>> >>>>>
>> >>>>> Try this: `uv_buf = uv_buf_init(...)` instead of just `uv_buf_init`.
>> >>>>>
>> >>>>> Anyway, that doesn't seem to be working... First of all, it won't be
>> >>>>> UV_NAMED_PIPE because it isn't it, it will be UV_UKNOWN_HANDLE and
>> >>>>> you
>> >>>>> should just try calling `uv_accept()` and see if it'll fail.
>> >>>>>
>> >>>>> But the most important thing is that you can only send sockets using
>> >>>>> `uv_write2()`, sending a file won't work.
>> >>>>>
>> >>>>> On Wed, Dec 11, 2013 at 1:57 PM, Pramod Sharma
>> >>>>> <[email protected]>
>> >>>>> wrote:
>> >>>>> > 0.10.19. Do you think I should try with  latest one ?
>> >>>>> >
>> >>>>> > On Wednesday, 11 December 2013 15:24:26 UTC+5:30, Fedor Indutny
>> >>>>> > wrote:
>> >>>>> >>
>> >>>>> >> Hello Pramod,
>> >>>>> >>
>> >>>>> >> Which libuv version are you using?
>> >>>>> >>
>> >>>>> >> On Wed, Dec 11, 2013 at 1:21 PM, Pramod Sharma
>> >>>>> >> <[email protected]>
>> >>>>> >> wrote:
>> >>>>> >> > Oh sorry forgot to mention that uv_write2 is passing from the
>> >>>>> >> > client
>> >>>>> >> > side
>> >>>>> >> > with status as 0 in the callback but it is never coming in the
>> >>>>> >> > server
>> >>>>> >> > read2_cb.
>> >>>>> >> >
>> >>>>> >> >
>> >>>>> >> > On Wednesday, 11 December 2013 14:25:31 UTC+5:30, Pramod Sharma
>> >>>>> >> > wrote:
>> >>>>> >> >>
>> >>>>> >> >> Can someone please help in me debugging as I am new to libuv ?
>> >>>>> >> >> I am trying to accomplish as follows
>> >>>>> >> >> - Create a server (domain socket)
>> >>>>> >> >> - Create a client
>> >>>>> >> >> - connect to server
>> >>>>> >> >> - pass the file descriptor(some arbitrary handle, xyz) using
>> >>>>> >> >> uv_write2
>> >>>>> >> >> - server accepts the file descriptor (arbitrary handle, xyz)
>> >>>>> >> >> and
>> >>>>> >> >> uses
>> >>>>> >> >> it
>> >>>>> >> >> to read it.
>> >>>>> >> >>
>> >>>>> >> >> Attached is my client and server program , I know I am doing
>> >>>>> >> >> some
>> >>>>> >> >> silly
>> >>>>> >> >> mistake somewhere.
>> >>>>> >> >>
>> >>>>> >> >> PS - please rename makefile.c to makefile as it was not
>> >>>>> >> >> allowing
>> >>>>> >> >> me to
>> >>>>> >> >> upload makefile.
>> >>>>> >> >>
>> >>>>> >> >>
>> >>>>> >> >> On Monday, 9 December 2013 14:04:48 UTC+5:30, Pramod Sharma
>> >>>>> >> >> wrote:
>> >>>>> >> >>>
>> >>>>> >> >>> What about windows ?
>> >>>>> >> >>> I just want to pass regular file handle(process file handle
>> >>>>> >> >>> which
>> >>>>> >> >>> is
>> >>>>> >> >>> trying to connect)  from the client to server and vice versa
>> >>>>> >> >>> so
>> >>>>> >> >>> that I
>> >>>>> >> >>> can
>> >>>>> >> >>> do some authentication on them.
>> >>>>> >> >>>
>> >>>>> >> >>> On Saturday, 19 October 2013 15:26:51 UTC+5:30, Ben Noordhuis
>> >>>>> >> >>> wrote:
>> >>>>> >> >>>>
>> >>>>> >> >>>> On Fri, Oct 18, 2013 at 11:09 PM, Pramod Sharma
>> >>>>> >> >>>> <[email protected]> wrote:
>> >>>>> >> >>>> > Thanks. So libuv internally is not doing anything with the
>> >>>>> >> >>>> > descriptor
>> >>>>> >> >>>> > assuming it is a pipe or so ?
>> >>>>> >> >>>>
>> >>>>> >> >>>> Not on UNIX platforms, no.
>> >>>>> >> >
>> >>>>> >> > --
>> >>>>> >> > You received this message because you are subscribed to the
>> >>>>> >> > Google
>> >>>>> >> > Groups
>> >>>>> >> > "libuv" group.
>> >>>>> >> > To unsubscribe from this group and stop receiving emails from
>> >>>>> >> > it,
>> >>>>> >> > send
>> >>>>> >> > an
>> >>>>> >> > email to [email protected].
>> >>>>> >> > To post to this group, send email to [email protected].
>> >>>>> >> > Visit this group at http://groups.google.com/group/libuv.
>> >>>>> >> > For more options, visit
>> >>>>> >> > https://groups.google.com/groups/opt_out.
>> >>>>> >
>> >>>>> > --
>> >>>>> > You received this message because you are subscribed to the Google
>> >>>>> > Groups
>> >>>>> > "libuv" group.
>> >>>>> > To unsubscribe from this group and stop receiving emails from it,
>> >>>>> > send
>> >>>>> > an
>> >>>>> > email to [email protected].
>> >>>>> > To post to this group, send email to [email protected].
>> >>>>> > Visit this group at http://groups.google.com/group/libuv.
>> >>>>> > For more options, visit https://groups.google.com/groups/opt_out.
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "libuv" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> >> an
>> >> email to [email protected].
>> >> To post to this group, send email to [email protected].
>> >> Visit this group at http://groups.google.com/group/libuv.
>> >> For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> You received this message because you are subscribed to the Google Groups
> "libuv" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/libuv.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to