elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


  Mostrar Mensajes
Páginas: 1 ... 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 [24] 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 ... 49
231  Programación / .NET (C#, VB.NET, ASP) / Re: [C#] Conectar Socket (denegación) en: 31 Agosto 2015, 03:09 am
Gracias nuevamente por las respuestas ocasionadas.

Cuando intento bindear ya me salta al mismo error que tenía al principio:



Así lo binde:

Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Net.Sockets;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace Server
  10. {
  11.    class Program
  12.    {
  13.        static void Main(string[] args)
  14.        {
  15.            Socket sck = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  16.  
  17.            IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 80);
  18.            //System.Threading.Thread t = new System.Threading.Thread(endPoint);
  19.            sck.Bind(endPoint);
  20.            sck.Listen(0);
  21.            System.Threading.Thread.Sleep(1000);
  22.            sck.Connect(endPoint);
  23.  
  24.  
  25.            Socket acc = sck.Accept();
  26.  
  27.            byte[] buffer = Encoding.Default.GetBytes("Hola Client!");
  28.            acc.Send(buffer, 0, buffer.Length, 0);
  29.  
  30.            buffer = new byte[255];
  31.  
  32.            int rec = acc.Receive(buffer, 0, buffer.Length, 0);
  33.  
  34.            Array.Resize(ref buffer, rec);
  35.  
  36.            Console.WriteLine("Mostrando: {0}", Encoding.Default.GetString(buffer));
  37.  
  38.            sck.Close();
  39.            acc.Close();
  40.  
  41.            Console.ReadKey();
  42.        }
  43.    }
  44. }
  45.  

Ejecuto siempre primero Server y luego Client. Aunque lo haga viceversa me salta el error en Server.

Pero esto ahora es raro no se por que me da permiso denegado.. ya esto no sería fallo del código ¿no?

Muchas gracias.

Saludos.
232  Programación / .NET (C#, VB.NET, ASP) / Re: [C#] Conectar Socket (denegación) en: 31 Agosto 2015, 02:41 am
Me quedo atrapado en escuchar el listen.

Código
  1. //System.Threading.Thread t = new System.Threading.Thread(endPoint);

No logro encontrar que valor devolverle. Pongo endPoint o sck y me subraya en error.

Por lo que he intentado hacerlo así:

Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Net.Sockets;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace Server
  10. {
  11.    class Program
  12.    {
  13.        static void Main(string[] args)
  14.        {
  15.            Socket sck = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  16.  
  17.            IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 80);
  18.            //System.Threading.Thread t = new System.Threading.Thread(endPoint);
  19.            sck.Listen(0);
  20.            System.Threading.Thread.Sleep(1000);
  21.            sck.Connect(endPoint);
  22.  
  23.  
  24.            Socket acc = sck.Accept();
  25.  
  26.            byte[] buffer = Encoding.Default.GetBytes("Hola Client!");
  27.            acc.Send(buffer, 0, buffer.Length, 0);
  28.  
  29.            buffer = new byte[255];
  30.  
  31.            int rec = acc.Receive(buffer, 0, buffer.Length, 0);
  32.  
  33.            Array.Resize(ref buffer, rec);
  34.  
  35.            Console.WriteLine("Mostrando: {0}", Encoding.Default.GetString(buffer));
  36.  
  37.            sck.Close();
  38.            acc.Close();
  39.  
  40.            Console.ReadKey();
  41.        }
  42.    }
  43. }
  44.  

Pero me marca que no le paso al sck.Listen un argumento válido.



Gracias y disculpe las molestias ocacionadas.

Saludos.
233  Programación / .NET (C#, VB.NET, ASP) / Re: [C#] Conectar Socket (denegación) en: 31 Agosto 2015, 02:18 am
Gracias por su respuesta.
He logrado algo más, pero me he quedado un poco atrancado por acá.

Tengo esto en server:

Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Net.Sockets;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace Server
  10. {
  11.    class Program
  12.    {
  13.        static void Main(string[] args)
  14.        {
  15.            Socket sck = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  16.  
  17.            IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 80);
  18.            System.Threading.Thread.Sleep(1000);
  19.            sck.Connect(endPoint);
  20.            sck.Listen(0);
  21.  
  22.  
  23.            Socket acc = sck.Accept();
  24.  
  25.            byte[] buffer = Encoding.Default.GetBytes("Hola Client!");
  26.            acc.Send(buffer, 0, buffer.Length, 0);
  27.  
  28.            buffer = new byte[255];
  29.  
  30.            int rec = acc.Receive(buffer, 0, buffer.Length, 0);
  31.  
  32.            Array.Resize(ref buffer, rec);
  33.  
  34.            Console.WriteLine("Mostrando: {0}", Encoding.Default.GetString(buffer));
  35.  
  36.            sck.Close();
  37.            acc.Close();
  38.  
  39.            Console.ReadKey();
  40.        }
  41.    }
  42. }
  43.  

Si no coloco:
Código
  1. sck.Listen(0);

Me da este mensaje:



Y si coloco el sck.Listen(0) me da esto:



Parece que fallo en algo... y no doy con ello. Disculpa las molestias ocasionadas.

Y aquí por si quiere ver la parte client (aquí creo que no me pasa nada ya que lo inicio y me dice que ingrese un mensaje, pero no recibo respuestas):

Código
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using System.Net;
  4. using System.Net.Sockets;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Client
  9. {
  10.    class Program
  11.    {
  12.        static void Main(string[] args)
  13.        {
  14.            Socket sck = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  15.  
  16.            IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 80);
  17.            sck.Connect(endPoint);
  18.  
  19.            Console.WriteLine("Introduzca su mensaje: ");
  20.            string msg = Console.ReadLine();
  21.  
  22.            byte[] msgBuffer = Encoding.Default.GetBytes(msg);
  23.            sck.Send(msgBuffer, 0, msgBuffer.Length, 0);
  24.  
  25.            byte[] buffer = new byte[255];
  26.  
  27.            int rec = sck.Receive(buffer, 0, buffer.Length, 0);
  28.  
  29.            Array.Resize(ref buffer, rec);
  30.  
  31.            Console.WriteLine("Recibo: {0}", Encoding.Default.GetString(buffer));
  32.  
  33.            Console.ReadKey();
  34.        }
  35.    }
  36. }

Lo tengo ordenados por 2 proyectos, osea Client y Server.



Gracias de nuevo.
Más o menos me acerco más al problema. Pero no se es raro.

Saludos.
234  Programación / .NET (C#, VB.NET, ASP) / Re: [C#] Conectar Socket (denegación) en: 30 Agosto 2015, 23:41 pm
Gracias por tu respuesta.

Creo que era problema al darle valor.

Ahora el problema es que me deniegan el acceso al socket:



La cosa es que en cliente me va bien, me muestra "introduzca el mensaje":

Código
  1. Socket sck = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  2.  
  3.            IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 80);
  4.            sck.Connect(endPoint);
  5.  
  6.            Console.WriteLine("Introduzca su mensaje: ");
  7.            string msg = Console.ReadLine();
  8.  
  9.            byte[] msgBuffer = Encoding.Default.GetBytes(msg);
  10.            sck.Send(msgBuffer, 0, msgBuffer.Length, 0);
  11.  
  12.            byte[] buffer = new byte[255];
  13.  
  14.            int rec = sck.Receive(buffer, 0, buffer.Length, 0);
  15.  
  16.            Array.Resize(ref buffer, rec);
  17.  
  18.            Console.WriteLine("Recibo: {0}", Encoding.Default.GetString(buffer));
  19.  
  20.            Console.ReadKey

Y el problema me lo da en el servidor al ejecutarlo:
Código
  1. Socket sck = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  2.  
  3.            IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 80);
  4.            sck.Bind(endPoint);
  5.            sck.Listen(0);
  6.  
  7.            Socket acc = sck.Accept();
  8.  
  9.            byte[] buffer = Encoding.Default.GetBytes("Hola Client!");
  10.            acc.Send(buffer, 0, buffer.Length, 0);
  11.  
  12.            buffer = new byte[255];
  13.  
  14.            int rec = acc.Receive(buffer, 0, buffer.Length, 0);
  15.  
  16.            Array.Resize(ref buffer, rec);
  17.  
  18.            Console.WriteLine("Mostrando: {0}", Encoding.Default.GetString(buffer));
  19.  
  20.            sck.Close();
  21.            acc.Close();
  22.  
  23.            Console.ReadKey();

¿A que puede deberse esto? ¿Puede estar ocupado el sockets?

Saludos.
235  Programación / .NET (C#, VB.NET, ASP) / Re: [C#] Conectar Socket (denegación) en: 30 Agosto 2015, 18:19 pm
si trabajas en tu propia máquina porque no usas 127.0.0.1???

Gracias por tu respuesta.
Parece funcionar en la clase Client.

Pero en la parte Server tengo esto:

Código
  1. Socket sck = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  2.  
  3. sck.Bind(new IPEndPoint(127.0.0.1, 80));
  4. sck.Listen(0);
  5.  

Y me marca error en IPEndPoint:



Cuando me debería aceptar el mismo parámetro que en Client, pero no.

Saludos.
236  Programación / .NET (C#, VB.NET, ASP) / [C#] Conectar Socket (denegación) en: 30 Agosto 2015, 17:55 pm
Buenas,

Tengo un problema a la hora de estableces una conexión socket con la pc.

Código
  1. IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("89.140.16.6"), 80);
  2. sck.Connect(endPoint);

Y me salta este error:



Me dice que el equipo denegó la conexión, y la IP que tengo colocada es la que me aparece en:http://www.cual-es-mi-ip.net/  
PD: No tengo ningún puerto abierto. (modem)

He pensado en bajarme Xampp y cambiar la ip por localhost pero no se si funcionará en W10 y si funcionará como espero.

Su supieran a que se debe dicho error lo agradecería.
Cualquier información adicional es bienvenida.

Saludos.
237  Programación / Java / Re: Ayuda para imprimir en un JTtextArea en: 30 Agosto 2015, 15:31 pm
Buenas,

Puede ser por:

Código
  1. textArea = new JTextArea(5, 20);

Y si no revisa este enlace de donde lo concluir, aquí puedes ver como hacerlo.

https://docs.oracle.com/javase/tutorial/uiswing/components/textarea.html

Saludos.
238  Foros Generales / Foro Libre / ¿Te dedicas hacer algún deporte? ¿estás fuerte? en: 30 Agosto 2015, 15:02 pm
Buenas,

La mayoría de lo que estamos aquí nos dedicamos a la informática...
¿Pero alguno se dedica al deporte en general?

¿Alguien va al gym? ¿estás petao  :rolleyes:?

¿Alguien está así?



Yo estaba en el gym hace unos meses.. y me puse fuertecito  :silbar: ¿Pero alguien está así como el de la foto?

Me puse fuerte sin tomar proteínas, ni nada full natural.

Saludos.
239  Programación / Desarrollo Web / Re: Problema al recargar div con AJAX en: 30 Agosto 2015, 13:43 pm
si fueran los estilos y el html, no crees que también me ocurriría en otros navegadores?.

No sé, si sabes que no todos los navegadores son compatibles con todas las páginas. Por lo que has que adaptarlas a dicho navegador si quieres una compatibilidad global.

Ej: IE no mostrará el contenido igual que en Chrome.

Saludos.
240  Seguridad Informática / Criptografía / [Consulta] ¿Tipos de cifrados más seguros que MD5? en: 30 Agosto 2015, 13:22 pm
Buenas,

Me gustaría saber cuales son los cifrados más seguros a día de hoy.
Yo conozco más que todo el MD5... y el de cesar aunque no lo catalogaría como tal.

¿Hay cifrados mejores que el MD5? ¿O existen combinaciones de cifrado para mejorar el cifrado aún más?

Si existen algún cifrado mejor que MD5, agradecería que me explicasen así por encima como funciona si no es mucha molestia.

Cualquier información adicional la agradecería.
Gracias.

Saludos.
Páginas: 1 ... 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 [24] 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 ... 49
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines