Hi!
I have a little problem programming sockets, with C#.
But first.. I wrote a client-server application:
Server - in C++. Simple console server, on the same computer, which response every time, when it gets something.. on port 5200.
Client - in C#. Like that:
(Connect, send, receive and close connection)
_serverHost = IPAddress.Parse("127.0.0.1");
_hostEndPoint = new IPEndPoint(_serverHost, 5200);
_serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_serverSocket.Connect(_hostEndPoint);
byte[] dataSend = CreateStartFrame();
_serverSocket.Send(dataSend);
byte[] dataRecv = new byte[RECV_BUF_SIZE];
int receivedDataLength = _serverSocket.Receive(dataRecv);
_serverSocket.Shutdown(SocketShutdown.Both);
_serverSocket.Close();
And that application - works.
Now, I want to something similar, but - on the external server with SSH on port 22.
What I;m doing now is: I use the same code, but with port 22, and host (my external host ip).
And I get this error:
System.Net.Sockets.SocketException (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
What I have to change in my code?
Or maybe I have to change something in Windows (Windows 7) - My firewall is turned off.. But I don't do nothing with Incoming/outcoming rules...