commit b8fe1bfd9bd662058c55f891824172fc649e9485 Author: juanjo Date: Fri Oct 27 12:18:56 2023 +0200 Código hpsp-csharp-03-socket diff --git a/00-Networking/00-Networking.csproj b/00-Networking/00-Networking.csproj new file mode 100644 index 0000000..4a66268 --- /dev/null +++ b/00-Networking/00-Networking.csproj @@ -0,0 +1,84 @@ + + + + + Debug + AnyCPU + {C0F4278B-AA34-4E61-8A5F-887D5C2D9A3A} + WinExe + _00_Networking + 00-Networking + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/00-Networking/App.config b/00-Networking/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/00-Networking/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/00-Networking/Form1.Designer.cs b/00-Networking/Form1.Designer.cs new file mode 100644 index 0000000..c8daac5 --- /dev/null +++ b/00-Networking/Form1.Designer.cs @@ -0,0 +1,109 @@ + +namespace _00_Networking { + partial class Form1 { + /// + /// Variable del diseñador necesaria. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Limpiar los recursos que se estén usando. + /// + /// true si los recursos administrados se deben desechar; false en caso contrario. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Código generado por el Diseñador de Windows Forms + + /// + /// Método necesario para admitir el Diseñador. No se puede modificar + /// el contenido de este método con el editor de código. + /// + private void InitializeComponent() { + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(21, 35); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(123, 50); + this.button1.TabIndex = 0; + this.button1.Text = "Direcciones Base"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(177, 35); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(123, 50); + this.button2.TabIndex = 1; + this.button2.Text = "mis IP"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button3 + // + this.button3.Location = new System.Drawing.Point(330, 35); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(123, 50); + this.button3.TabIndex = 2; + this.button3.Text = "IPEndPoint"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button4 + // + this.button4.Location = new System.Drawing.Point(482, 35); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(123, 50); + this.button4.TabIndex = 3; + this.button4.Text = "DNS--> IP"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // button5 + // + this.button5.Location = new System.Drawing.Point(624, 35); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(123, 50); + this.button5.TabIndex = 4; + this.button5.Text = " IP-->DNS"; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.button5); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button5; + } +} + diff --git a/00-Networking/Form1.cs b/00-Networking/Form1.cs new file mode 100644 index 0000000..a06f5f7 --- /dev/null +++ b/00-Networking/Form1.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace _00_Networking { + public partial class Form1 : Form { + public Form1() { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) { + IPAddress IP1 = IPAddress.Parse("172.156.11.1"); + IPAddress IP2 = IPAddress.Loopback; + IPAddress IP3 = IPAddress.Broadcast; + IPAddress IP4 = IPAddress.Any; + IPAddress IP5 = IPAddress.None; + + Debug.WriteLine("IP transformada: " + IP1.ToString()); + Debug.WriteLine("IP loopback: " + IP2.ToString()); + Debug.WriteLine("IP broadcast: " + IP3.ToString()); + Debug.WriteLine("IP any: " + IP4.ToString()); + Debug.WriteLine("IP none: " + IP5.ToString()); + } + + private void button2_Click(object sender, EventArgs e) { + IPHostEntry ihe = Dns.GetHostEntry(Dns.GetHostName()); + Debug.WriteLine ("Nombrehost: " + Dns.GetHostName()); + foreach (IPAddress ip in ihe.AddressList) { + if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) + Debug.WriteLine(ip.ToString()); + } + } + + private void button3_Click(object sender, EventArgs e) { + IPAddress ip1 = IPAddress.Parse("142.250.184.164"); + IPEndPoint ie = new IPEndPoint(ip1, 80); + Debug.WriteLine("El IPEndPoint es: " + ie.ToString()); + Debug.WriteLine("La familia del protocolo es: " + ie.AddressFamily); + } + + private void button4_Click(object sender, EventArgs e) { + IPHostEntry resultados = Dns.GetHostEntry("www.marcombo.com"); + //IPHostEntry resultados = Dns.GetHostEntry("www.microsoft.net"); + foreach (IPAddress ip in resultados.AddressList) + Debug.WriteLine(ip.ToString()); + } + + private void button5_Click(object sender, EventArgs e) { + try { + String IP = "216.58.209.69"; + IPHostEntry host = Dns.GetHostEntry(IP); + Debug.WriteLine("La IP " + IP + " tiene una entrada DNS: " + host.HostName); + } + catch (Exception ex) { + Debug.WriteLine(ex.Message); + } + } + } +} diff --git a/00-Networking/Form1.resx b/00-Networking/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/00-Networking/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/00-Networking/Program.cs b/00-Networking/Program.cs new file mode 100644 index 0000000..78366ab --- /dev/null +++ b/00-Networking/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace _00_Networking { + static class Program { + /// + /// Punto de entrada principal para la aplicación. + /// + [STAThread] + static void Main() { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/00-Networking/Properties/AssemblyInfo.cs b/00-Networking/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9ca4e07 --- /dev/null +++ b/00-Networking/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// La información general de un ensamblado se controla mediante el siguiente +// conjunto de atributos. Cambie estos valores de atributo para modificar la información +// asociada con un ensamblado. +[assembly: AssemblyTitle("00-Networking")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("00-Networking")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles +// para los componentes COM. Si es necesario obtener acceso a un tipo en este ensamblado desde +// COM, establezca el atributo ComVisible en true en este tipo. +[assembly: ComVisible(false)] + +// El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM. +[assembly: Guid("c0f4278b-aa34-4e61-8a5f-887d5c2d9a3a")] + +// La información de versión de un ensamblado consta de los cuatro valores siguientes: +// +// Versión principal +// Versión secundaria +// Número de compilación +// Revisión +// +// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión +// utilizando el carácter "*", como se muestra a continuación: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/00-Networking/Properties/Resources.Designer.cs b/00-Networking/Properties/Resources.Designer.cs new file mode 100644 index 0000000..d1837ea --- /dev/null +++ b/00-Networking/Properties/Resources.Designer.cs @@ -0,0 +1,66 @@ +//------------------------------------------------------------------------------ +// +// Este código fue generado por una herramienta. +// Versión de runtime: 4.0.30319.42000 +// +// Los cambios de este archivo pueden provocar un comportamiento inesperado y se perderán si +// el código se vuelve a generar. +// +//------------------------------------------------------------------------------ + + +namespace _00_Networking.Properties { + /// + /// Clase de recurso fuertemente tipado para buscar cadenas traducidas, etc. + /// + // StronglyTypedResourceBuilder generó automáticamente esta clase + // a través de una herramienta como ResGen o Visual Studio. + // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen + // con la opción /str o recompile su proyecto de VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Devuelve la instancia ResourceManager almacenada en caché utilizada por esta clase. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("_00_Networking.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Invalida la propiedad CurrentUICulture del subproceso actual para todas las + /// búsquedas de recursos usando esta clase de recursos fuertemente tipados. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/00-Networking/Properties/Resources.resx b/00-Networking/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/00-Networking/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/00-Networking/Properties/Settings.Designer.cs b/00-Networking/Properties/Settings.Designer.cs new file mode 100644 index 0000000..5c01bf8 --- /dev/null +++ b/00-Networking/Properties/Settings.Designer.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +namespace _00_Networking.Properties { + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/00-Networking/Properties/Settings.settings b/00-Networking/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/00-Networking/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/00-Networking/borra.cs b/00-Networking/borra.cs new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/00-Networking/borra.cs @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/01-HolaSocketServidor/01-HolaSocketServidor.csproj b/01-HolaSocketServidor/01-HolaSocketServidor.csproj new file mode 100644 index 0000000..a4bf88e --- /dev/null +++ b/01-HolaSocketServidor/01-HolaSocketServidor.csproj @@ -0,0 +1,83 @@ + + + + + Debug + AnyCPU + {6367A3C1-5367-4E43-B0A0-A8BA7607CBBC} + WinExe + _01_HolaSocketServidor + 01-HolaSocketServidor + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/01-HolaSocketServidor/App.config b/01-HolaSocketServidor/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/01-HolaSocketServidor/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/01-HolaSocketServidor/Form1.Designer.cs b/01-HolaSocketServidor/Form1.Designer.cs new file mode 100644 index 0000000..10b9fd7 --- /dev/null +++ b/01-HolaSocketServidor/Form1.Designer.cs @@ -0,0 +1,61 @@ +namespace _01_HolaSocketServidor +{ + partial class Form1 + { + /// + /// Variable del diseñador necesaria. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Limpiar los recursos que se estén usando. + /// + /// true si los recursos administrados se deben desechar; false en caso contrario. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Código generado por el Diseñador de Windows Forms + + /// + /// Método necesario para admitir el Diseñador. No se puede modificar + /// el contenido de este método con el editor de código. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(60, 62); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(279, 139); + this.button1.TabIndex = 0; + this.button1.Text = "Conectar Servidor"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.Button1_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button button1; + } +} + diff --git a/01-HolaSocketServidor/Form1.cs b/01-HolaSocketServidor/Form1.cs new file mode 100644 index 0000000..ebf4d55 --- /dev/null +++ b/01-HolaSocketServidor/Form1.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace _01_HolaSocketServidor +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private void Button1_Click(object sender, EventArgs e) + { + Socket miSocketServidor = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + IPEndPoint miDireccionEscucha = new IPEndPoint(IPAddress.Any, 2000); + try + { + miSocketServidor.Bind(miDireccionEscucha); + miSocketServidor.Listen(1); + + //esta línea es bloqueante + Socket cliente = miSocketServidor.Accept(); + + Debug.WriteLine("Conexión exitosa del cliente: " + + cliente.RemoteEndPoint.ToString()); + cliente.Close(); + miSocketServidor.Close(); + + } + catch (Exception error) + { + Debug.WriteLine("Error: {0}", error.ToString()); + } + } + } +} diff --git a/01-HolaSocketServidor/Form1.resx b/01-HolaSocketServidor/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/01-HolaSocketServidor/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/01-HolaSocketServidor/Program.cs b/01-HolaSocketServidor/Program.cs new file mode 100644 index 0000000..5324303 --- /dev/null +++ b/01-HolaSocketServidor/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace _01_HolaSocketServidor +{ + static class Program + { + /// + /// Punto de entrada principal para la aplicación. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/01-HolaSocketServidor/Properties/AssemblyInfo.cs b/01-HolaSocketServidor/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b43be27 --- /dev/null +++ b/01-HolaSocketServidor/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// La información general de un ensamblado se controla mediante el siguiente +// conjunto de atributos. Cambie estos valores de atributo para modificar la información +// asociada con un ensamblado. +[assembly: AssemblyTitle("01-HolaSocketServidor")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("01-HolaSocketServidor")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles +// para los componentes COM. Si es necesario obtener acceso a un tipo en este ensamblado desde +// COM, establezca el atributo ComVisible en true en este tipo. +[assembly: ComVisible(false)] + +// El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM. +[assembly: Guid("6367a3c1-5367-4e43-b0a0-a8ba7607cbbc")] + +// La información de versión de un ensamblado consta de los cuatro valores siguientes: +// +// Versión principal +// Versión secundaria +// Número de compilación +// Revisión +// +// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión +// utilizando el carácter "*", como se muestra a continuación: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/01-HolaSocketServidor/Properties/Resources.Designer.cs b/01-HolaSocketServidor/Properties/Resources.Designer.cs new file mode 100644 index 0000000..a156991 --- /dev/null +++ b/01-HolaSocketServidor/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Este código fue generado por una herramienta. +// Versión de runtime: 4.0.30319.42000 +// +// Los cambios de este archivo pueden provocar un comportamiento inesperado y se perderán si +// el código se vuelve a generar. +// +//------------------------------------------------------------------------------ + +namespace _01_HolaSocketServidor.Properties +{ + + + /// + /// Clase de recurso fuertemente tipado para buscar cadenas traducidas, etc. + /// + // StronglyTypedResourceBuilder generó automáticamente esta clase + // a través de una herramienta como ResGen o Visual Studio. + // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen + // con la opción /str o recompile su proyecto de VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Devuelve la instancia ResourceManager almacenada en caché utilizada por esta clase. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("_01_HolaSocketServidor.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Invalida la propiedad CurrentUICulture del subproceso actual para todas las + /// búsquedas de recursos usando esta clase de recursos fuertemente tipados. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/01-HolaSocketServidor/Properties/Resources.resx b/01-HolaSocketServidor/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/01-HolaSocketServidor/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/01-HolaSocketServidor/Properties/Settings.Designer.cs b/01-HolaSocketServidor/Properties/Settings.Designer.cs new file mode 100644 index 0000000..4e42a3a --- /dev/null +++ b/01-HolaSocketServidor/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace _01_HolaSocketServidor.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/01-HolaSocketServidor/Properties/Settings.settings b/01-HolaSocketServidor/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/01-HolaSocketServidor/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/02-HolaSocketCliente/02-HolaSocketCliente.csproj b/02-HolaSocketCliente/02-HolaSocketCliente.csproj new file mode 100644 index 0000000..64c29fb --- /dev/null +++ b/02-HolaSocketCliente/02-HolaSocketCliente.csproj @@ -0,0 +1,83 @@ + + + + + Debug + AnyCPU + {265F00B5-2EB3-40B1-86F9-D70CB23A2C63} + WinExe + _02_HolaSocketCliente + 02-HolaSocketCliente + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/02-HolaSocketCliente/App.config b/02-HolaSocketCliente/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/02-HolaSocketCliente/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/02-HolaSocketCliente/Form1.Designer.cs b/02-HolaSocketCliente/Form1.Designer.cs new file mode 100644 index 0000000..2540fcb --- /dev/null +++ b/02-HolaSocketCliente/Form1.Designer.cs @@ -0,0 +1,73 @@ +namespace _02_HolaSocketCliente +{ + partial class Form1 + { + /// + /// Variable del diseñador necesaria. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Limpiar los recursos que se estén usando. + /// + /// true si los recursos administrados se deben desechar; false en caso contrario. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Código generado por el Diseñador de Windows Forms + + /// + /// Método necesario para admitir el Diseñador. No se puede modificar + /// el contenido de este método con el editor de código. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(12, 29); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(344, 150); + this.button1.TabIndex = 0; + this.button1.Text = "Conectar al servidor"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.Button1_Click); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(376, 95); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(198, 20); + this.textBox1.TabIndex = 1; + this.textBox1.Text = "10.10.32.50"; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox textBox1; + } +} + diff --git a/02-HolaSocketCliente/Form1.cs b/02-HolaSocketCliente/Form1.cs new file mode 100644 index 0000000..d605f03 --- /dev/null +++ b/02-HolaSocketCliente/Form1.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace _02_HolaSocketCliente +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private void Button1_Click(object sender, EventArgs e) + { + Socket miSocketCliente = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + IPEndPoint miServidor = new IPEndPoint( IPAddress.Parse(this.textBox1.Text) , 2000); + try + { + miSocketCliente.Connect(miServidor); + Debug.WriteLine("Conectado con éxito"); + miSocketCliente.Close(); + } + catch (Exception error) + { + Debug.WriteLine("Error: " + error.ToString()); + } + } + } +} diff --git a/02-HolaSocketCliente/Form1.resx b/02-HolaSocketCliente/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/02-HolaSocketCliente/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/02-HolaSocketCliente/Program.cs b/02-HolaSocketCliente/Program.cs new file mode 100644 index 0000000..79ee5bb --- /dev/null +++ b/02-HolaSocketCliente/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace _02_HolaSocketCliente +{ + static class Program + { + /// + /// Punto de entrada principal para la aplicación. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/02-HolaSocketCliente/Properties/AssemblyInfo.cs b/02-HolaSocketCliente/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..78980d8 --- /dev/null +++ b/02-HolaSocketCliente/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// La información general de un ensamblado se controla mediante el siguiente +// conjunto de atributos. Cambie estos valores de atributo para modificar la información +// asociada con un ensamblado. +[assembly: AssemblyTitle("02-HolaSocketCliente")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("02-HolaSocketCliente")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles +// para los componentes COM. Si es necesario obtener acceso a un tipo en este ensamblado desde +// COM, establezca el atributo ComVisible en true en este tipo. +[assembly: ComVisible(false)] + +// El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM. +[assembly: Guid("265f00b5-2eb3-40b1-86f9-d70cb23a2c63")] + +// La información de versión de un ensamblado consta de los cuatro valores siguientes: +// +// Versión principal +// Versión secundaria +// Número de compilación +// Revisión +// +// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión +// utilizando el carácter "*", como se muestra a continuación: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/02-HolaSocketCliente/Properties/Resources.Designer.cs b/02-HolaSocketCliente/Properties/Resources.Designer.cs new file mode 100644 index 0000000..d5fefb7 --- /dev/null +++ b/02-HolaSocketCliente/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Este código fue generado por una herramienta. +// Versión de runtime: 4.0.30319.42000 +// +// Los cambios de este archivo pueden provocar un comportamiento inesperado y se perderán si +// el código se vuelve a generar. +// +//------------------------------------------------------------------------------ + +namespace _02_HolaSocketCliente.Properties +{ + + + /// + /// Clase de recurso fuertemente tipado para buscar cadenas traducidas, etc. + /// + // StronglyTypedResourceBuilder generó automáticamente esta clase + // a través de una herramienta como ResGen o Visual Studio. + // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen + // con la opción /str o recompile su proyecto de VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Devuelve la instancia ResourceManager almacenada en caché utilizada por esta clase. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("_02_HolaSocketCliente.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Invalida la propiedad CurrentUICulture del subproceso actual para todas las + /// búsquedas de recursos usando esta clase de recursos fuertemente tipados. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/02-HolaSocketCliente/Properties/Resources.resx b/02-HolaSocketCliente/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/02-HolaSocketCliente/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/02-HolaSocketCliente/Properties/Settings.Designer.cs b/02-HolaSocketCliente/Properties/Settings.Designer.cs new file mode 100644 index 0000000..766f90a --- /dev/null +++ b/02-HolaSocketCliente/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace _02_HolaSocketCliente.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/02-HolaSocketCliente/Properties/Settings.settings b/02-HolaSocketCliente/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/02-HolaSocketCliente/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/03-SocketServidorDatos/03-SocketServidorDatos.csproj b/03-SocketServidorDatos/03-SocketServidorDatos.csproj new file mode 100644 index 0000000..eeb7eb4 --- /dev/null +++ b/03-SocketServidorDatos/03-SocketServidorDatos.csproj @@ -0,0 +1,83 @@ + + + + + Debug + AnyCPU + {FB4B3211-377A-44A6-AC2D-3B430558E185} + WinExe + _03_SocketServidorDatos + 03-SocketServidorDatos + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/03-SocketServidorDatos/App.config b/03-SocketServidorDatos/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/03-SocketServidorDatos/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/03-SocketServidorDatos/Form1.Designer.cs b/03-SocketServidorDatos/Form1.Designer.cs new file mode 100644 index 0000000..b8c3e7c --- /dev/null +++ b/03-SocketServidorDatos/Form1.Designer.cs @@ -0,0 +1,74 @@ +namespace _03_SocketServidorDatos +{ + partial class Form1 + { + /// + /// Variable del diseñador necesaria. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Limpiar los recursos que se estén usando. + /// + /// true si los recursos administrados se deben desechar; false en caso contrario. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Código generado por el Diseñador de Windows Forms + + /// + /// Método necesario para admitir el Diseñador. No se puede modificar + /// el contenido de este método con el editor de código. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(67, 45); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(279, 139); + this.button1.TabIndex = 1; + this.button1.Text = "Conectar Servidor"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.Button1_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(111, 238); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(50, 13); + this.label1.TabIndex = 2; + this.label1.Text = "Datos....."; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.label1); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label1; + } +} + diff --git a/03-SocketServidorDatos/Form1.cs b/03-SocketServidorDatos/Form1.cs new file mode 100644 index 0000000..0fc7625 --- /dev/null +++ b/03-SocketServidorDatos/Form1.cs @@ -0,0 +1,41 @@ +using System; +using System.Diagnostics; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Windows.Forms; + +namespace _03_SocketServidorDatos { + public partial class Form1 : Form { + public Form1() { + InitializeComponent(); + } + + private void Button1_Click(object sender, EventArgs e) { + Socket miSocketServidor = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + IPEndPoint miDireccionEscucha = new IPEndPoint(IPAddress.Any, 2000); + try { + miSocketServidor.Bind(miDireccionEscucha); + miSocketServidor.Listen(1); + + //esta línea es bloqueante + Socket cliente = miSocketServidor.Accept(); + + Debug.WriteLine("Conexión exitosa del cliente: " + + cliente.RemoteEndPoint.ToString()); + + //recepción de datos + byte[] byteRecibidos = new byte[1000]; + int datos = cliente.Receive(byteRecibidos, 0, byteRecibidos.Length, SocketFlags.None); + this.label1.Text = Encoding.Default.GetString(byteRecibidos, 0, datos); + + cliente.Close(); + miSocketServidor.Close(); + + } + catch (Exception error) { + Debug.WriteLine("Error: {0}", error.ToString()); + } + } + } +} diff --git a/03-SocketServidorDatos/Form1.resx b/03-SocketServidorDatos/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/03-SocketServidorDatos/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/03-SocketServidorDatos/Program.cs b/03-SocketServidorDatos/Program.cs new file mode 100644 index 0000000..532fe26 --- /dev/null +++ b/03-SocketServidorDatos/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace _03_SocketServidorDatos +{ + static class Program + { + /// + /// Punto de entrada principal para la aplicación. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/03-SocketServidorDatos/Properties/AssemblyInfo.cs b/03-SocketServidorDatos/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..51c2d28 --- /dev/null +++ b/03-SocketServidorDatos/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// La información general de un ensamblado se controla mediante el siguiente +// conjunto de atributos. Cambie estos valores de atributo para modificar la información +// asociada con un ensamblado. +[assembly: AssemblyTitle("03-SocketServidorDatos")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("03-SocketServidorDatos")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles +// para los componentes COM. Si es necesario obtener acceso a un tipo en este ensamblado desde +// COM, establezca el atributo ComVisible en true en este tipo. +[assembly: ComVisible(false)] + +// El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM. +[assembly: Guid("fb4b3211-377a-44a6-ac2d-3b430558e185")] + +// La información de versión de un ensamblado consta de los cuatro valores siguientes: +// +// Versión principal +// Versión secundaria +// Número de compilación +// Revisión +// +// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión +// utilizando el carácter "*", como se muestra a continuación: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/03-SocketServidorDatos/Properties/Resources.Designer.cs b/03-SocketServidorDatos/Properties/Resources.Designer.cs new file mode 100644 index 0000000..0cdf081 --- /dev/null +++ b/03-SocketServidorDatos/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Este código fue generado por una herramienta. +// Versión de runtime: 4.0.30319.42000 +// +// Los cambios de este archivo pueden provocar un comportamiento inesperado y se perderán si +// el código se vuelve a generar. +// +//------------------------------------------------------------------------------ + +namespace _03_SocketServidorDatos.Properties +{ + + + /// + /// Clase de recurso fuertemente tipado para buscar cadenas traducidas, etc. + /// + // StronglyTypedResourceBuilder generó automáticamente esta clase + // a través de una herramienta como ResGen o Visual Studio. + // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen + // con la opción /str o recompile su proyecto de VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Devuelve la instancia ResourceManager almacenada en caché utilizada por esta clase. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("_03_SocketServidorDatos.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Invalida la propiedad CurrentUICulture del subproceso actual para todas las + /// búsquedas de recursos usando esta clase de recursos fuertemente tipados. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/03-SocketServidorDatos/Properties/Resources.resx b/03-SocketServidorDatos/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/03-SocketServidorDatos/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/03-SocketServidorDatos/Properties/Settings.Designer.cs b/03-SocketServidorDatos/Properties/Settings.Designer.cs new file mode 100644 index 0000000..c457f71 --- /dev/null +++ b/03-SocketServidorDatos/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace _03_SocketServidorDatos.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/03-SocketServidorDatos/Properties/Settings.settings b/03-SocketServidorDatos/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/03-SocketServidorDatos/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/04-SocketClienteDatos/04-SocketClienteDatos.csproj b/04-SocketClienteDatos/04-SocketClienteDatos.csproj new file mode 100644 index 0000000..a1fa1d9 --- /dev/null +++ b/04-SocketClienteDatos/04-SocketClienteDatos.csproj @@ -0,0 +1,83 @@ + + + + + Debug + AnyCPU + {AFB61416-8412-4D79-9C35-34E19191C99D} + WinExe + _04_SocketClienteDatos + 04-SocketClienteDatos + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/04-SocketClienteDatos/App.config b/04-SocketClienteDatos/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/04-SocketClienteDatos/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/04-SocketClienteDatos/Form1.Designer.cs b/04-SocketClienteDatos/Form1.Designer.cs new file mode 100644 index 0000000..24309b3 --- /dev/null +++ b/04-SocketClienteDatos/Form1.Designer.cs @@ -0,0 +1,83 @@ +namespace _04_SocketClienteDatos +{ + partial class Form1 + { + /// + /// Variable del diseñador necesaria. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Limpiar los recursos que se estén usando. + /// + /// true si los recursos administrados se deben desechar; false en caso contrario. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Código generado por el Diseñador de Windows Forms + + /// + /// Método necesario para admitir el Diseñador. No se puede modificar + /// el contenido de este método con el editor de código. + /// + private void InitializeComponent() + { + this.textBox1 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(395, 93); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(198, 20); + this.textBox1.TabIndex = 3; + this.textBox1.Text = "127.0.0.1"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(31, 27); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(344, 150); + this.button1.TabIndex = 2; + this.button1.Text = "Conectar al servidor"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.Button1_Click); + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(93, 217); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(253, 20); + this.textBox2.TabIndex = 4; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox textBox2; + } +} + diff --git a/04-SocketClienteDatos/Form1.cs b/04-SocketClienteDatos/Form1.cs new file mode 100644 index 0000000..70e1e69 --- /dev/null +++ b/04-SocketClienteDatos/Form1.cs @@ -0,0 +1,36 @@ +using System; +using System.Diagnostics; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Windows.Forms; + +namespace _04_SocketClienteDatos { + public partial class Form1 : Form { + public Form1() { + InitializeComponent(); + } + + private void Button1_Click(object sender, EventArgs e) { + Socket miSocketCliente = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + IPEndPoint miServidor = new IPEndPoint(IPAddress.Parse(this.textBox1.Text), 2000); + try { + miSocketCliente.Connect(miServidor); + Debug.WriteLine("Conectado con éxito"); + + + //envío de datos + byte[] textoEnviar; + textoEnviar = Encoding.Default.GetBytes(this.textBox2.Text); + miSocketCliente.Send(textoEnviar, 0, textoEnviar.Length, SocketFlags.None); + Debug.WriteLine("Texto enviado con éxito"); + + //cerrar + miSocketCliente.Close(); + } + catch (Exception error) { + Debug.WriteLine("Error: " + error.ToString()); + } + } + } +} diff --git a/04-SocketClienteDatos/Form1.resx b/04-SocketClienteDatos/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/04-SocketClienteDatos/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/04-SocketClienteDatos/Program.cs b/04-SocketClienteDatos/Program.cs new file mode 100644 index 0000000..3ab8548 --- /dev/null +++ b/04-SocketClienteDatos/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace _04_SocketClienteDatos +{ + static class Program + { + /// + /// Punto de entrada principal para la aplicación. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/04-SocketClienteDatos/Properties/AssemblyInfo.cs b/04-SocketClienteDatos/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..12a6a91 --- /dev/null +++ b/04-SocketClienteDatos/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// La información general de un ensamblado se controla mediante el siguiente +// conjunto de atributos. Cambie estos valores de atributo para modificar la información +// asociada con un ensamblado. +[assembly: AssemblyTitle("04-SocketClienteDatos")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("04-SocketClienteDatos")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles +// para los componentes COM. Si es necesario obtener acceso a un tipo en este ensamblado desde +// COM, establezca el atributo ComVisible en true en este tipo. +[assembly: ComVisible(false)] + +// El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM. +[assembly: Guid("afb61416-8412-4d79-9c35-34e19191c99d")] + +// La información de versión de un ensamblado consta de los cuatro valores siguientes: +// +// Versión principal +// Versión secundaria +// Número de compilación +// Revisión +// +// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión +// utilizando el carácter "*", como se muestra a continuación: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/04-SocketClienteDatos/Properties/Resources.Designer.cs b/04-SocketClienteDatos/Properties/Resources.Designer.cs new file mode 100644 index 0000000..7858e03 --- /dev/null +++ b/04-SocketClienteDatos/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Este código fue generado por una herramienta. +// Versión de runtime: 4.0.30319.42000 +// +// Los cambios de este archivo pueden provocar un comportamiento inesperado y se perderán si +// el código se vuelve a generar. +// +//------------------------------------------------------------------------------ + +namespace _04_SocketClienteDatos.Properties +{ + + + /// + /// Clase de recurso fuertemente tipado para buscar cadenas traducidas, etc. + /// + // StronglyTypedResourceBuilder generó automáticamente esta clase + // a través de una herramienta como ResGen o Visual Studio. + // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen + // con la opción /str o recompile su proyecto de VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Devuelve la instancia ResourceManager almacenada en caché utilizada por esta clase. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("_04_SocketClienteDatos.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Invalida la propiedad CurrentUICulture del subproceso actual para todas las + /// búsquedas de recursos usando esta clase de recursos fuertemente tipados. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/04-SocketClienteDatos/Properties/Resources.resx b/04-SocketClienteDatos/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/04-SocketClienteDatos/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/04-SocketClienteDatos/Properties/Settings.Designer.cs b/04-SocketClienteDatos/Properties/Settings.Designer.cs new file mode 100644 index 0000000..4b5539c --- /dev/null +++ b/04-SocketClienteDatos/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace _04_SocketClienteDatos.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/04-SocketClienteDatos/Properties/Settings.settings b/04-SocketClienteDatos/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/04-SocketClienteDatos/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/05-SocketServidorUDP/05-SocketServidorUDP.csproj b/05-SocketServidorUDP/05-SocketServidorUDP.csproj new file mode 100644 index 0000000..1527e52 --- /dev/null +++ b/05-SocketServidorUDP/05-SocketServidorUDP.csproj @@ -0,0 +1,83 @@ + + + + + Debug + AnyCPU + {996EC79F-25CB-472E-BEB8-DFABC97E5A08} + WinExe + _05_SocketServidorUDP + 05-SocketServidorUDP + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/05-SocketServidorUDP/App.config b/05-SocketServidorUDP/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/05-SocketServidorUDP/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/05-SocketServidorUDP/Form1.Designer.cs b/05-SocketServidorUDP/Form1.Designer.cs new file mode 100644 index 0000000..3fe5178 --- /dev/null +++ b/05-SocketServidorUDP/Form1.Designer.cs @@ -0,0 +1,81 @@ + +namespace _05_SocketServidorUDP { + partial class Form1 { + /// + /// Variable del diseñador necesaria. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Limpiar los recursos que se estén usando. + /// + /// true si los recursos administrados se deben desechar; false en caso contrario. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Código generado por el Diseñador de Windows Forms + + /// + /// Método necesario para admitir el Diseñador. No se puede modificar + /// el contenido de este método con el editor de código. + /// + private void InitializeComponent() { + this.label1 = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(93, 215); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(50, 13); + this.label1.TabIndex = 4; + this.label1.Text = "Datos....."; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(49, 22); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(279, 139); + this.button1.TabIndex = 3; + this.button1.Text = "Conectar Servidor"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(363, 82); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(234, 20); + this.textBox1.TabIndex = 5; + this.textBox1.Text = "Hola desde el Servidor UDP"; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label1); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox textBox1; + } +} + diff --git a/05-SocketServidorUDP/Form1.cs b/05-SocketServidorUDP/Form1.cs new file mode 100644 index 0000000..00fd2d2 --- /dev/null +++ b/05-SocketServidorUDP/Form1.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace _05_SocketServidorUDP { + public partial class Form1 : Form { + public Form1() { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) { + int numDatos; + byte[] byteRecibidos = new byte[1000]; + byte[] byteEnviados = new byte[1000]; + + Socket miSocketServidor = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); + IPEndPoint miDireccionEscucha = new IPEndPoint(IPAddress.Any, 2000); + try { + miSocketServidor.Bind(miDireccionEscucha); + + IPEndPoint receptor = new IPEndPoint(IPAddress.Any, 0); + EndPoint remoto = (EndPoint)(receptor); + + //recepción de datos + numDatos = miSocketServidor.ReceiveFrom(byteRecibidos, ref remoto); + Debug.WriteLine("Datos recibidos del cliente: " + remoto.ToString()); + this.label1.Text = Encoding.ASCII.GetString(byteRecibidos, 0, numDatos); + + //envío de datos + byteEnviados = Encoding.ASCII.GetBytes(this.textBox1.Text); + miSocketServidor.SendTo(byteEnviados, byteEnviados.Length, SocketFlags.None, remoto); + + miSocketServidor.Close(); + } + catch (Exception error) { + Debug.WriteLine("Error: {0}", error.ToString()); + } + } + } +} diff --git a/05-SocketServidorUDP/Form1.resx b/05-SocketServidorUDP/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/05-SocketServidorUDP/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/05-SocketServidorUDP/Program.cs b/05-SocketServidorUDP/Program.cs new file mode 100644 index 0000000..05d2f81 --- /dev/null +++ b/05-SocketServidorUDP/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace _05_SocketServidorUDP { + static class Program { + /// + /// Punto de entrada principal para la aplicación. + /// + [STAThread] + static void Main() { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/05-SocketServidorUDP/Properties/AssemblyInfo.cs b/05-SocketServidorUDP/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3c4bdac --- /dev/null +++ b/05-SocketServidorUDP/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// La información general de un ensamblado se controla mediante el siguiente +// conjunto de atributos. Cambie estos valores de atributo para modificar la información +// asociada con un ensamblado. +[assembly: AssemblyTitle("05-SocketServidorUDP")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("05-SocketServidorUDP")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles +// para los componentes COM. Si es necesario obtener acceso a un tipo en este ensamblado desde +// COM, establezca el atributo ComVisible en true en este tipo. +[assembly: ComVisible(false)] + +// El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM. +[assembly: Guid("996ec79f-25cb-472e-beb8-dfabc97e5a08")] + +// La información de versión de un ensamblado consta de los cuatro valores siguientes: +// +// Versión principal +// Versión secundaria +// Número de compilación +// Revisión +// +// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión +// utilizando el carácter "*", como se muestra a continuación: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/05-SocketServidorUDP/Properties/Resources.Designer.cs b/05-SocketServidorUDP/Properties/Resources.Designer.cs new file mode 100644 index 0000000..a1957c1 --- /dev/null +++ b/05-SocketServidorUDP/Properties/Resources.Designer.cs @@ -0,0 +1,66 @@ +//------------------------------------------------------------------------------ +// +// Este código fue generado por una herramienta. +// Versión de runtime: 4.0.30319.42000 +// +// Los cambios de este archivo pueden provocar un comportamiento inesperado y se perderán si +// el código se vuelve a generar. +// +//------------------------------------------------------------------------------ + + +namespace _05_SocketServidorUDP.Properties { + /// + /// Clase de recurso fuertemente tipado para buscar cadenas traducidas, etc. + /// + // StronglyTypedResourceBuilder generó automáticamente esta clase + // a través de una herramienta como ResGen o Visual Studio. + // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen + // con la opción /str o recompile su proyecto de VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Devuelve la instancia ResourceManager almacenada en caché utilizada por esta clase. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("_05_SocketServidorUDP.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Invalida la propiedad CurrentUICulture del subproceso actual para todas las + /// búsquedas de recursos usando esta clase de recursos fuertemente tipados. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/05-SocketServidorUDP/Properties/Resources.resx b/05-SocketServidorUDP/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/05-SocketServidorUDP/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/05-SocketServidorUDP/Properties/Settings.Designer.cs b/05-SocketServidorUDP/Properties/Settings.Designer.cs new file mode 100644 index 0000000..483c75c --- /dev/null +++ b/05-SocketServidorUDP/Properties/Settings.Designer.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +namespace _05_SocketServidorUDP.Properties { + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/05-SocketServidorUDP/Properties/Settings.settings b/05-SocketServidorUDP/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/05-SocketServidorUDP/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/06-SocketClienteUDP/06-SocketClienteUDP.csproj b/06-SocketClienteUDP/06-SocketClienteUDP.csproj new file mode 100644 index 0000000..b5c9044 --- /dev/null +++ b/06-SocketClienteUDP/06-SocketClienteUDP.csproj @@ -0,0 +1,83 @@ + + + + + Debug + AnyCPU + {9DF185EC-38AF-4FAE-8BD2-52AC91A7EFA1} + WinExe + _06_SocketClienteUDP + 06-SocketClienteUDP + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/06-SocketClienteUDP/App.config b/06-SocketClienteUDP/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/06-SocketClienteUDP/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/06-SocketClienteUDP/Form1.Designer.cs b/06-SocketClienteUDP/Form1.Designer.cs new file mode 100644 index 0000000..fab4e65 --- /dev/null +++ b/06-SocketClienteUDP/Form1.Designer.cs @@ -0,0 +1,91 @@ + +namespace _06_SocketClienteUDP { + partial class Form1 { + /// + /// Variable del diseñador necesaria. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Limpiar los recursos que se estén usando. + /// + /// true si los recursos administrados se deben desechar; false en caso contrario. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Código generado por el Diseñador de Windows Forms + + /// + /// Método necesario para admitir el Diseñador. No se puede modificar + /// el contenido de este método con el editor de código. + /// + private void InitializeComponent() { + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(110, 227); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(253, 20); + this.textBox2.TabIndex = 7; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(412, 103); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(198, 20); + this.textBox1.TabIndex = 6; + this.textBox1.Text = "127.0.0.1"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(48, 37); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(344, 150); + this.button1.TabIndex = 5; + this.button1.Text = "Conectar al servidor"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(107, 275); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(35, 13); + this.label1.TabIndex = 8; + this.label1.Text = "label1"; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label1; + } +} + diff --git a/06-SocketClienteUDP/Form1.cs b/06-SocketClienteUDP/Form1.cs new file mode 100644 index 0000000..aa97af8 --- /dev/null +++ b/06-SocketClienteUDP/Form1.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace _06_SocketClienteUDP { + public partial class Form1 : Form { + public Form1() { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) { + int numDatos; + byte[] byteRecibidos = new byte[1000]; + byte[] byteEnviados = new byte[1000]; + + Socket miSocketServidor = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); + IPEndPoint dirEnvio = new IPEndPoint(IPAddress.Parse(this.textBox1.Text), 2000); + try { + //envío de datos + byteEnviados = Encoding.ASCII.GetBytes(this.textBox2.Text); + miSocketServidor.SendTo(byteEnviados, byteEnviados.Length, SocketFlags.None, dirEnvio); + + IPEndPoint receptor = new IPEndPoint(IPAddress.Any, 0); + EndPoint remoto = (EndPoint)(receptor); + + //recepción de datos + numDatos = miSocketServidor.ReceiveFrom(byteRecibidos, ref remoto); + Debug.WriteLine("Datos recibidos del cliente: " + remoto.ToString()); + this.label1.Text = Encoding.ASCII.GetString(byteRecibidos, 0, numDatos); + + miSocketServidor.Close(); + } + catch (Exception error) { + Debug.WriteLine("Error: {0}", error.ToString()); + } + } + } +} diff --git a/06-SocketClienteUDP/Form1.resx b/06-SocketClienteUDP/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/06-SocketClienteUDP/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/06-SocketClienteUDP/Program.cs b/06-SocketClienteUDP/Program.cs new file mode 100644 index 0000000..fe6f3c7 --- /dev/null +++ b/06-SocketClienteUDP/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace _06_SocketClienteUDP { + static class Program { + /// + /// Punto de entrada principal para la aplicación. + /// + [STAThread] + static void Main() { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/06-SocketClienteUDP/Properties/AssemblyInfo.cs b/06-SocketClienteUDP/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..4fd752f --- /dev/null +++ b/06-SocketClienteUDP/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// La información general de un ensamblado se controla mediante el siguiente +// conjunto de atributos. Cambie estos valores de atributo para modificar la información +// asociada con un ensamblado. +[assembly: AssemblyTitle("06-SocketClienteUDP")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("06-SocketClienteUDP")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles +// para los componentes COM. Si es necesario obtener acceso a un tipo en este ensamblado desde +// COM, establezca el atributo ComVisible en true en este tipo. +[assembly: ComVisible(false)] + +// El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM. +[assembly: Guid("9df185ec-38af-4fae-8bd2-52ac91a7efa1")] + +// La información de versión de un ensamblado consta de los cuatro valores siguientes: +// +// Versión principal +// Versión secundaria +// Número de compilación +// Revisión +// +// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión +// utilizando el carácter "*", como se muestra a continuación: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/06-SocketClienteUDP/Properties/Resources.Designer.cs b/06-SocketClienteUDP/Properties/Resources.Designer.cs new file mode 100644 index 0000000..b857d39 --- /dev/null +++ b/06-SocketClienteUDP/Properties/Resources.Designer.cs @@ -0,0 +1,66 @@ +//------------------------------------------------------------------------------ +// +// Este código fue generado por una herramienta. +// Versión de runtime: 4.0.30319.42000 +// +// Los cambios de este archivo pueden provocar un comportamiento inesperado y se perderán si +// el código se vuelve a generar. +// +//------------------------------------------------------------------------------ + + +namespace _06_SocketClienteUDP.Properties { + /// + /// Clase de recurso fuertemente tipado para buscar cadenas traducidas, etc. + /// + // StronglyTypedResourceBuilder generó automáticamente esta clase + // a través de una herramienta como ResGen o Visual Studio. + // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen + // con la opción /str o recompile su proyecto de VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Devuelve la instancia ResourceManager almacenada en caché utilizada por esta clase. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("_06_SocketClienteUDP.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Invalida la propiedad CurrentUICulture del subproceso actual para todas las + /// búsquedas de recursos usando esta clase de recursos fuertemente tipados. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/06-SocketClienteUDP/Properties/Resources.resx b/06-SocketClienteUDP/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/06-SocketClienteUDP/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/06-SocketClienteUDP/Properties/Settings.Designer.cs b/06-SocketClienteUDP/Properties/Settings.Designer.cs new file mode 100644 index 0000000..2027fec --- /dev/null +++ b/06-SocketClienteUDP/Properties/Settings.Designer.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +namespace _06_SocketClienteUDP.Properties { + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/06-SocketClienteUDP/Properties/Settings.settings b/06-SocketClienteUDP/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/06-SocketClienteUDP/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Sockets.sln b/Sockets.sln new file mode 100644 index 0000000..75e2efa --- /dev/null +++ b/Sockets.sln @@ -0,0 +1,61 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.28729.10 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "01-HolaSocketServidor", "01-HolaSocketServidor\01-HolaSocketServidor.csproj", "{6367A3C1-5367-4E43-B0A0-A8BA7607CBBC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "02-HolaSocketCliente", "02-HolaSocketCliente\02-HolaSocketCliente.csproj", "{265F00B5-2EB3-40B1-86F9-D70CB23A2C63}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "03-SocketServidorDatos", "03-SocketServidorDatos\03-SocketServidorDatos.csproj", "{FB4B3211-377A-44A6-AC2D-3B430558E185}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "04-SocketClienteDatos", "04-SocketClienteDatos\04-SocketClienteDatos.csproj", "{AFB61416-8412-4D79-9C35-34E19191C99D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "00-Networking", "00-Networking\00-Networking.csproj", "{C0F4278B-AA34-4E61-8A5F-887D5C2D9A3A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "05-SocketServidorUDP", "05-SocketServidorUDP\05-SocketServidorUDP.csproj", "{996EC79F-25CB-472E-BEB8-DFABC97E5A08}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "06-SocketClienteUDP", "06-SocketClienteUDP\06-SocketClienteUDP.csproj", "{9DF185EC-38AF-4FAE-8BD2-52AC91A7EFA1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6367A3C1-5367-4E43-B0A0-A8BA7607CBBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6367A3C1-5367-4E43-B0A0-A8BA7607CBBC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6367A3C1-5367-4E43-B0A0-A8BA7607CBBC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6367A3C1-5367-4E43-B0A0-A8BA7607CBBC}.Release|Any CPU.Build.0 = Release|Any CPU + {265F00B5-2EB3-40B1-86F9-D70CB23A2C63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {265F00B5-2EB3-40B1-86F9-D70CB23A2C63}.Debug|Any CPU.Build.0 = Debug|Any CPU + {265F00B5-2EB3-40B1-86F9-D70CB23A2C63}.Release|Any CPU.ActiveCfg = Release|Any CPU + {265F00B5-2EB3-40B1-86F9-D70CB23A2C63}.Release|Any CPU.Build.0 = Release|Any CPU + {FB4B3211-377A-44A6-AC2D-3B430558E185}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FB4B3211-377A-44A6-AC2D-3B430558E185}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FB4B3211-377A-44A6-AC2D-3B430558E185}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FB4B3211-377A-44A6-AC2D-3B430558E185}.Release|Any CPU.Build.0 = Release|Any CPU + {AFB61416-8412-4D79-9C35-34E19191C99D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AFB61416-8412-4D79-9C35-34E19191C99D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AFB61416-8412-4D79-9C35-34E19191C99D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AFB61416-8412-4D79-9C35-34E19191C99D}.Release|Any CPU.Build.0 = Release|Any CPU + {C0F4278B-AA34-4E61-8A5F-887D5C2D9A3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C0F4278B-AA34-4E61-8A5F-887D5C2D9A3A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C0F4278B-AA34-4E61-8A5F-887D5C2D9A3A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C0F4278B-AA34-4E61-8A5F-887D5C2D9A3A}.Release|Any CPU.Build.0 = Release|Any CPU + {996EC79F-25CB-472E-BEB8-DFABC97E5A08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {996EC79F-25CB-472E-BEB8-DFABC97E5A08}.Debug|Any CPU.Build.0 = Debug|Any CPU + {996EC79F-25CB-472E-BEB8-DFABC97E5A08}.Release|Any CPU.ActiveCfg = Release|Any CPU + {996EC79F-25CB-472E-BEB8-DFABC97E5A08}.Release|Any CPU.Build.0 = Release|Any CPU + {9DF185EC-38AF-4FAE-8BD2-52AC91A7EFA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9DF185EC-38AF-4FAE-8BD2-52AC91A7EFA1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9DF185EC-38AF-4FAE-8BD2-52AC91A7EFA1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9DF185EC-38AF-4FAE-8BD2-52AC91A7EFA1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {78BB6CC8-032D-4630-A260-B4BA0C66647D} + EndGlobalSection +EndGlobal