Java Socket Bridge unable to connect

I have a project for varsity where we should use Java Socket Bridge to connect to a chat server (that is how I understand the project at least).

So according to this github page, you should add this to your head

<script type="text/javascript" src="java_socket_bridge.js"></script>

and this to your body

<applet id="JavaSocketBridge" archive="JavaSocketBridge.jar" code="JavaSocketBridge.class" width="0" height="0"></applet>

I have done so and I also ran the make.sh file to produce the jar file. Here is my php file:

<?php session_start(); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta charset="utf-8">
        <script type="text/javascript" src="java_socket_bridge.js"></script>
        <title>ValidateLogin</title>
    </head>
    <body>
        <?php
            $ip = $_POST['ip'];
            $port = $_POST['port'];
            $_SESSION['sid'] = session_id();
            $_SESSION['ip'] = $ip;
            $_SESSION['port'] = $port;
            // header("location: Game.php");
            echo '  <applet id="JavaSocketBridge" code="JavaSocketBridge.class" archive="JavaSocketBridge.jar" height="0" width="0"></applet>';
            echo "  <script>
                        console.log(document.getElementById('JavaSocketBridge'));
                        if(socket_connect('".$ip."', '".$port."'))
                        {
                            console.log('connected!');
                        }
                        else
                        {
                            console.log('not connected!');
                        }
                    </script>";
        ?>
    </body>
</html>

So my problem is that when I call the socket_connect() function my web console displays

"Java Socket Bridge cannot connect until the applet has loaded" "not connected!"

I have tried calling the java_socket_bridge_ready() function (although it was not specified to do so) and then the web console displays:

TypeError: get_java_socket_bridge(...).connect is not a function

on line 39 of the java_socket_bridge.js file.

I can't find any help on Google on this issue I've been looking all day. I am using Ubuntu 14.04 and the latest firefox and XAMPP to run my webserver.

Answers


I figured out that I have to enable Java in my browser. I used this page from Java's website on how to install and enable Java in my browser.


Need Your Help

How to write a wrapper over functions and member functions that executes some code before and after the wrapped function?

c++ python binding wrapper boost-python

I'm trying to write some wrapper class or function that allows me to execute some code before and after the wrapped function.

There is any Open source dating site?

open-source

I'm working on dating site project, but I can't find any open source dating site any more, please tell me,if any open source dating site. (PHP or ASP.NET)