[gnet] Is it ok to call gnet_tcp_socket_delete() in child process?
- From: "Vrihad Shoonya" <vrihad myway com>
- To: gnet gnetlibrary org
- Cc:
- Subject: [gnet] Is it ok to call gnet_tcp_socket_delete() in child process?
- Date: Fri, 23 May 2003 09:24:29 -0400 (EDT)
Dear pals,
I have a doubt regarding deleting a gnet tcp socket object.
I am working on a network app where I am calling the function
gnet_tcp_socket_server_accept_async(sock, handler, NULL).
In the handler() I am calling fork() after checking for some
conditions. Just after this point, in the parent process I need
to close the connection socket while in the child I need to
close listening socket.
Since I am dealing with gnet_tcp_socket, is it ok if I call
gnet_tcp_soket_delete() with respective socket objects? Or on
the other hand should I call close(fd) where fd is the file
descriptor obtained from concerned gnet_tcp_socket?
The question arises because as per my understanding, when fork()
is called, kernel just makes an image of the running process
and duplicates the open file descriptors for child. This means
all data is duplicated. If some data is pointing to some memory
location in parent process, it remains that way in child too.
So internal pointers held by components in gnet framework in
both the processes are still pointing to the same locations in
memory. Is my understanding correct? Pointers to further
information in this regard is appreciated.
Thanks in advance
vrihad
_______________________________________________
No banners. No pop-ups. No kidding.
Introducing My Way - http://www.myway.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]