Re: About JBC1.1b
From: Lars-Inge Tønnessen [VJ# MVP] (http://emailme.larsinge.com)
Date: 02/27/05
- Previous message: Lars-Inge Tønnessen [VJ# MVP]: "Re: Bug in ArrayList.toArray() method?"
- In reply to: mela mela via DotNetMonster.com: "Re: About JBC1.1b"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 27 Feb 2005 19:39:22 +0100
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
- Previous message: Lars-Inge Tønnessen [VJ# MVP]: "Re: Bug in ArrayList.toArray() method?"
- In reply to: mela mela via DotNetMonster.com: "Re: About JBC1.1b"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|