Forgive me, but I am quite a newbie when it comes to this. I am trying to find a way to connect to a socket in C# similar to what I would be able to do with PuTTY. For instance, in PuTTy, for my purpose, I would enter the IP and port, select Raw connection type, then open the connection. I thought the below code would work, but it throws a SocketException saying "An attempt was made to access a socket in a way forbidden by its access permissions".
class Class_1
{
static void Main(string[] args)
{
Socket socket = new Socket(SocketType.Raw, ProtocolType.Tcp);
/*
* Below is not the actual IP and port I am using, of course.
* It is simply for illustrative purposes.
*/
socket.Connect(new IPAddress(new byte[] { 1, 1, 1, 1 }), 1);
Console.WriteLine(socket.Poll(10000000, SelectMode.SelectRead));
Console.Read();
}
}
Any help would be most appreciate. Thanks in advance.