<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <linklocation="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
<summary>Container for widgets from other processes.</summary>
<remarks>
<para>Together with <seecref="T:Gtk.Plug"/>, <seecref="T:Gtk.Socket"/> provides the ability to embed widgets from one process into another process in a fashion that is transparent to the user. One process creates a <seecref="T:Gtk.Socket"/> widget and, passes the window ID of that widget to the other process, which then creates a <seecref="T:Gtk.Plug"/> with that window ID. Any widgets contained in the <seecref="T:Gtk.Plug"/> then will appear inside the first applications window.</para>
<para>The window ID of the <seecref="T:Gtk.Socket"/> is obtained by using <seecref="M:Gtk.Socket.GetId()"/>. Before using this function, the socket must have been realized, and therefore, have been added to its parent.</para>
<example>
<codelanguage="C#">
Gtk.Socket socket = new Gtk.Socket;
socket.Show ();
parent.Add (socket);
Console.WriteLine ("The ID of the sockets window is {0}", socket.Id);
</code>
</example>
<para>Note that if you pass the window ID of the socket to another process that will create a plug in the socket, you must make sure that the socket widget is not destroyed until that plug is created. Violating this rule will cause unpredictable consequences, the most likely consequence being that the plug will appear as a separate toplevel window. You can check if the plug has been created by examining the plug_window field of the <seecref="T:Gtk.Socket"/> structure. If this field is non-<seelangword="null"/>, then the plug has been successfully created inside of the socket.</para>
<para>When Gtk# is notified that the embedded window has been destroyed, then it will destroy the socket as well. You should always, therefore, be prepared for your sockets to be destroyed at any time when the main event loop is running.</para>
<para>The communication between a <seecref="T:Gtk.Socket"/> and a <seecref="T:Gtk.Plug"/> follows the XEmbed protocol. This protocol has also been implemented in other toolkits, e.g. Qt, allowing the same level of integration when embedding a Qt widget in GTK or vice versa.</para>
<para>A socket can also be used to swallow arbitrary pre-existing top-level windows using <seecref="M:Gtk.Socket.Steal()"/>, though the integration when this is done will not be as close as between a <seecref="T:Gtk.Plug"/> and a <seecref="T:Gtk.Socket"/>.</para>
<summary>Adds an XEMBED client, such as a <seecref="T:Gtk.Plug"/>, to the <seecref="T:Gtk.Socket"/>.</summary>
<paramname="window_id">an object of type <seecref="T:System.UInt32"/></param>
<remarks>
<para>The client may be in the same process or in a different process.</para>
<para>To embed a <seecref="T:Gtk.Plug"/> in a <seecref="T:Gtk.Socket"/>, you can either create the <seecref="T:Gtk.Plug"/> with <seecref="C:Gtk.Plug()"/>, call <seecref="M:Gtk.Plug.GetId()"/> to get the window ID of the plug, and then pass that to the <seecref="M:Gtk.Socket.AddId()"/>, or you can call <seecref="M:Gtk.Socket.GetId()"/> to get the window ID for the socket, and call <seecref="C:Gtk.Plug()"/> passing in that ID.</para>
<para>The <seecref="T:Gtk.Socket"/> must have already be added into a toplevel window before you can make this call.</para>
<summary>The window ID of a <seecref="T:Gtk.Socket"/> widget.</summary>
<returns>an object of type <seecref="T:System.UInt32"/></returns>
<remarks>This can be used to create a client embedded inside the socket, for instance with <seecref="C:Gtk.Plug()"/>. The <seecref="T:Gtk.Socket"/> must have already be added into a toplevel window before you can make this call.</remarks>
<summary>This event is emitted when a client is removed from the socket.</summary>
<remarks>The default action is to destroy the <seecref="T:Gtk.Socket"/> widget, so if you want to reuse it you must add a signal handler that returns <seelangword="true"/>.</remarks>