Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Visual J# / February 2005

Tip: Looking for answers? Try searching our database.

About JBC1.1b

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mela mela - 24 Feb 2005 16:52 GMT
Could JSharp Browser Control 1.1b create a Socket() and connect to the same
Web server that the J# Browser Control is downloaded from?

I attemped to convert a applet to JSharp Browser Control,but it had a
SecurityException in runtime when I used a Socket() class.
Lars-Inge T?nnessen [VJ# MVP] - 26 Feb 2005 19:38 GMT
Please see this article:

http://msdn.microsoft.com/library/en-us/dv_vstechart/html/vjtchSecuritySemantics
ForJBrowserControls.asp


Regards,
Lars-Inge T?nnessen
mela mela - 27 Feb 2005 04:23 GMT
Yeah,I have seen it before.
But In applet I could make a TCP Socket connection to the same site where
applet was downloaded from.
I converted my applet to J# Browser Controls,
but it gives me a SecurityException at runtime.

Thank you for your reply.
Lars-Inge T?nnessen [VJ# MVP] - 27 Feb 2005 18:39 GMT
Sounds like a configuration problem. I have just tested a socket connection
from a JBC to the server the JBC was loaded from. It's working for me.

Please check the "J# Browser Security control" in the "Administrative tools"
in the Control Panel.

In the "Microsoft .NET Framework 1.1 wizard shotcut", "Adjust .NET
security", "make changes for this computer", "next"choose "Full Trust" for
the site/internet option.

My test example:

The "index.html" file:
<HTML>
<BODY>
<OBJECT CLASSID="clsid:a399591c-0fd0-41f8-9d25-bd76f632415f"
WIDTH=300 HEIGHT=110
ID=Go
VJSCODEBASE = "JBC_Socket.dll#Go" >
</OBJECT>
</BODY>
</HTML>

The JBC "Go.java"
This is a J# Class library project.

public class Go extends java.applet.Applet
{
public void init( )
{
 try
 {
  java.net.Socket socket = new java.net.Socket( "localhost", 4566 );
  String message = "I'm a client";
  String receivedMEss = "";

  java.io.DataOutputStream out = new java.io.DataOutputStream(
socket.getOutputStream() );
  out.writeBytes( message );

  java.io.BufferedReader reader = new java.io.BufferedReader( new
java.io.InputStreamReader( socket.getInputStream() ) );
  receivedMEss = reader.readLine();

  this.add( new java.awt.Label( receivedMEss ) );
 }
 catch ( Exception e ) { }
}

public void paint( java.awt.Graphics g )
{
 this.setBackground( java.awt.Color.black );
 this.setForeground( java.awt.Color.white );
 g.drawLine( 0,0, 50, 50 );
}
}

The socket server :
public class Class1
{
public Class1()
{
 System.Net.Sockets.TcpListener listener = new
System.Net.Sockets.TcpListener( 4566 );
 listener.Start();

 System.Net.Sockets.TcpClient client = listener.AcceptTcpClient();
 System.Net.Sockets.NetworkStream strem = client.GetStream();

 ubyte byt[] = new ubyte[2048];
 strem.Read( byt, 0, 1000 );

 String s = System.Text.Encoding.get_ASCII().GetString(byt, 0, 1000);
 System.Console.WriteLine( "->" + s );

 ubyte[] out = System.Text.Encoding.get_ASCII().GetBytes("Hello back");
 strem.Write( out, 0, out.length );

 strem.Close();

}

/** @attribute System.STAThread() */
public static void main(String[] args)
{
 new Class1();
}
}

Regards,
Lars-Inge T?nnessen
mela mela - 28 Feb 2005 12:13 GMT
Oh~thx~
I could connected now,but that sounds odd.
It said in the second level of trust for assemblies
the program can connected back to their site of origin.
But it just works when I choose fulltrust.@@

Thank you for your reply^^

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.