By creating a GtkSocket,
an entirely different Gtk application may embed itself into your
has nothing to do with network sockets.
You can't use it to communicate between different computers.
The play between GtkSocket and GtkPlug
is the following:
Create a GtkSocket and attach it to a
GtkContainer, e.g. a GtkWindow.
- Realize the socket
(after adding it to the container).
Now you can access the socket id via
Create the GtkPlug with the socket id as parameter.
Add whatever you want to the plug - it will appear in the first container.
Note that when a GtkSocket is destroyed, the plugged-in
GtkPlug application will be destroyed as well.
As soon the GtkPlug unplugs from the socket,
the GtkSocket can't really be used any more. One could re-realize it,
but there will be errors and the socket won't be visible.
You can catch the unplugging-event by connecting to the
"unrealize" signal of the
socket. Note that you also will be notified if you application is
being destroyed. There is no other way to do this since the
plug-added and plug-removed
signals exist in gtk2 only.
A use for this widget is that you could write your own editor based on
vim by letting it plug into the socket
provided by your app:
gvim --socketid <id of your socket>
Note that you need to have the gtk version of gvim for this purpose.