Do you think this is stupid ?
-
Try this peace of code .. instead of giving an error it connects to a ipHostEntry that doesn't exist Can anyone tell me why ? Why me ? Oh .. why ? using System; using System.Net; using System.Net.Sockets; namespace ThisIsStupid { public class MainC { public static void Main() { IPEndPoint ipe = new IPEndPoint( IPAddress.Parse( "193.168.0.6"),21); //System.Diagnostics.Debug.WriteLine( ipadd ); Socket s = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp); // Console.WriteLine(s.Connected ); s.Connect(ipe ); if( s.Connected ) { Console.WriteLine( " I have a socket that didn't connect to nothing "); Console.WriteLine(" But it's status is connected "); Console.WriteLine(" Uraaa !"); } } } } I've made a client - server aplication and my class informes the main program that the requiered connection exists when no client is available there .. ? Why ... is that correct ... what am I doing rong ? Lazar Mihai Highschool student
-
Try this peace of code .. instead of giving an error it connects to a ipHostEntry that doesn't exist Can anyone tell me why ? Why me ? Oh .. why ? using System; using System.Net; using System.Net.Sockets; namespace ThisIsStupid { public class MainC { public static void Main() { IPEndPoint ipe = new IPEndPoint( IPAddress.Parse( "193.168.0.6"),21); //System.Diagnostics.Debug.WriteLine( ipadd ); Socket s = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp); // Console.WriteLine(s.Connected ); s.Connect(ipe ); if( s.Connected ) { Console.WriteLine( " I have a socket that didn't connect to nothing "); Console.WriteLine(" But it's status is connected "); Console.WriteLine(" Uraaa !"); } } } } I've made a client - server aplication and my class informes the main program that the requiered connection exists when no client is available there .. ? Why ... is that correct ... what am I doing rong ? Lazar Mihai Highschool student
Port 21 is the port used by FTP. Do you have an existing FTP server on that machine?
My: Blog | Photos | Next SQL Presentation WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
-
Port 21 is the port used by FTP. Do you have an existing FTP server on that machine?
My: Blog | Photos | Next SQL Presentation WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
NO .. I tried with port 7891 and with 4545 .. if you have any other suggestions ... try on you computer you'll get the same result Lazar Mihai Highschool student
-
NO .. I tried with port 7891 and with 4545 .. if you have any other suggestions ... try on you computer you'll get the same result Lazar Mihai Highschool student
I extended your class so I could see what was happening. When I tried the other ports you mentioned I got an exception to say that it wasn't connected. When I tried port 21 my application returned:
32 32 30 20 4d 69 63 72 : 220 Micr
6f 73 6f 66 74 20 46 54 : osof t FT
50 20 53 65 72 76 69 63 : P Se rvic
65 d a 0 0 0 0 0 : epublic class MainC { private static byte\[\] buffer = new byte\[1024\]; public static void Main() { IPEndPoint ipe = new IPEndPoint( IPAddress.Parse( "127.0.0.1"),21); //System.Diagnostics.Debug.WriteLine( ipadd ); Socket s = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp); // Console.WriteLine(s.Connected ); s.Connect(ipe ); if( s.Connected ) { Console.WriteLine( " I have a socket that didn't connect to nothing "); Console.WriteLine(" But it's status is connected "); Console.WriteLine(" Uraaa !"); } else { Console.WriteLine("Not Connected"); } int result = s.Receive(buffer, 1024, SocketFlags.Peek); Console.WriteLine("Received {0} bytes", result); for(int i=0; i<result; i+=8) { Console.WriteLine("{0:x} {1:x} {2:x} {3:x} {4:x} {5:x} {6:x} {7:x} : {8}{9}{10}{11} {12}{13}{14}{15}", buffer\[i\], buffer\[i+1\], buffer\[i+2\], buffer\[i+3\], buffer\[i+4\], buffer\[i+5\], buffer\[i+6\], buffer\[i+7\], (char)buffer\[i\], (char)buffer\[i+1\], (char)buffer\[i+2\], (char)buffer\[i+3\], (char)buffer\[i+4\], (char)buffer\[i+5\], (char)buffer\[i+6\], (char)buffer\[i+7\] ); } Console.ReadLine(); }
My: Blog | Photos | Next SQL Presentation WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
-
I extended your class so I could see what was happening. When I tried the other ports you mentioned I got an exception to say that it wasn't connected. When I tried port 21 my application returned:
32 32 30 20 4d 69 63 72 : 220 Micr
6f 73 6f 66 74 20 46 54 : osof t FT
50 20 53 65 72 76 69 63 : P Se rvic
65 d a 0 0 0 0 0 : epublic class MainC { private static byte\[\] buffer = new byte\[1024\]; public static void Main() { IPEndPoint ipe = new IPEndPoint( IPAddress.Parse( "127.0.0.1"),21); //System.Diagnostics.Debug.WriteLine( ipadd ); Socket s = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp); // Console.WriteLine(s.Connected ); s.Connect(ipe ); if( s.Connected ) { Console.WriteLine( " I have a socket that didn't connect to nothing "); Console.WriteLine(" But it's status is connected "); Console.WriteLine(" Uraaa !"); } else { Console.WriteLine("Not Connected"); } int result = s.Receive(buffer, 1024, SocketFlags.Peek); Console.WriteLine("Received {0} bytes", result); for(int i=0; i<result; i+=8) { Console.WriteLine("{0:x} {1:x} {2:x} {3:x} {4:x} {5:x} {6:x} {7:x} : {8}{9}{10}{11} {12}{13}{14}{15}", buffer\[i\], buffer\[i+1\], buffer\[i+2\], buffer\[i+3\], buffer\[i+4\], buffer\[i+5\], buffer\[i+6\], buffer\[i+7\], (char)buffer\[i\], (char)buffer\[i+1\], (char)buffer\[i+2\], (char)buffer\[i+3\], (char)buffer\[i+4\], (char)buffer\[i+5\], (char)buffer\[i+6\], (char)buffer\[i+7\] ); } Console.ReadLine(); }
My: Blog | Photos | Next SQL Presentation WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
Don't connect to local host ... on local hosts it works ... I want on other ip addresses not to work ... Lazar Mihai Highschool student
-
Don't connect to local host ... on local hosts it works ... I want on other ip addresses not to work ... Lazar Mihai Highschool student
Sorry, same deal if I use my external IP address. On port 21 I get a message from the FTP service I'm running, and on the other two ports it causes an exception because it cannot connect.
My: Blog | Photos | Next SQL Presentation WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
-
Try this peace of code .. instead of giving an error it connects to a ipHostEntry that doesn't exist Can anyone tell me why ? Why me ? Oh .. why ? using System; using System.Net; using System.Net.Sockets; namespace ThisIsStupid { public class MainC { public static void Main() { IPEndPoint ipe = new IPEndPoint( IPAddress.Parse( "193.168.0.6"),21); //System.Diagnostics.Debug.WriteLine( ipadd ); Socket s = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp); // Console.WriteLine(s.Connected ); s.Connect(ipe ); if( s.Connected ) { Console.WriteLine( " I have a socket that didn't connect to nothing "); Console.WriteLine(" But it's status is connected "); Console.WriteLine(" Uraaa !"); } } } } I've made a client - server aplication and my class informes the main program that the requiered connection exists when no client is available there .. ? Why ... is that correct ... what am I doing rong ? Lazar Mihai Highschool student
Try this: telnet 193.168.0.6 21 If telnet connects, this is a valid host/port combination. I see dead pixels Yes, even I am blogging now!
-
Sorry, same deal if I use my external IP address. On port 21 I get a message from the FTP service I'm running, and on the other two ports it causes an exception because it cannot connect.
My: Blog | Photos | Next SQL Presentation WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
You are right .. thanks I think I 've fixed the bug Lazar Mihai Highschool student
-
Try this: telnet 193.168.0.6 21 If telnet connects, this is a valid host/port combination. I see dead pixels Yes, even I am blogging now!
Cool ... telnet worked .. why if the address doesn't exist on the LAN .. ? Lazar Mihai Highschool student