Re: [gnet-devel] I/O redirect to GTcpSocket



On Thu, 2007-12-13 at 17:19 +0800, Kuang-Chun Cheng wrote:

> I'm wondering how to redirect stdin/stdout/stderr to GTcpSocket by
> using dup/dup2 POSIX AIP.
> 
> I knew GTcpSocket struct should be considered as a blackbox, but
> to achieve the above goal, I need to get internal socket descriptor. 
> And gnet API can do that ?
> 
> I'm using gnet as cross platform between Linux/Win32 ... I think
> instead of getting the internel socket descriptor, it's better have
> API like gnet_dup() or gnet_dup2() ....  any comment ? 

Why not just set up watches (via g_io_channel_new_unix() +
g_io_add_watch) and then write/read the data to/from the socket in the
normal way?

In any case, you should be able to get the fd via
g_io_channel_unix_get_fd() from the socket's GIOChannel.

Cheers
 -Tim




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]