[Mono-dev] Status of CodeAccessSecurity (CAS)?
David Wolinsky
davidiw at ufl.edu
Wed Nov 14 11:24:52 EST 2007
In mono version r88278 ... this code crashes really bad.... (see
below). I just wanted to know if anyone was actively working on this?
Also is anyone working on the FileIOPermission?
Regards,
David
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Security;
using System.Security.Permissions;
public class Test {
public static void Main() {
SocketPermission sp = new SocketPermission(PermissionState.None);
sp.Demand();
sp.Deny();
ST();
}
public static void ST() {
string server = "www.google.com";
int port = 80;
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
s.Connect(server, port);
string request = "GET / HTTP/1.1\r\nHost: www.google.com\r\n\r\n";
byte[] bs = Encoding.ASCII.GetBytes(request);
s.Send(bs, bs.Length, 0);
string page = String.Empty;
byte[] br = new byte[256];
int bytes = 0;
do {
bytes = s.Receive(br, br.Length, 0);
page += Encoding.ASCII.GetString(br, 0, bytes);
} while (bytes > 0);
Console.WriteLine(page);
}
}
More information about the Mono-devel-list
mailing list