Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7609851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:16:31+00:00 2026-05-31T01:16:31+00:00

I am trying to read binary data in javascript. I got one BinaryReader.js on

  • 0

I am trying to read binary data in javascript. I got one BinaryReader.js on net. I copied that file where Default.aspx is. If I write the code like following then project got build and running but handshake is not getting done. If I remove src=”BinaryReader.js” then handshake is getting done properly. So my question is, Can I use external script along with my script in same asp.net page? If yes then what am i doing wrong?

<script src="BinaryReader.js" language="javascript" type = "text/javascript">
    var ws;
    function btnConnectSend_onclick() {
        if ("WebSocket" in window) {
            ws = new WebSocket("ws://localhost:35000/");
            ws.onopen = function() {
                alert("Connection Open......");
            };
            ws.onmessage = function(evt) {
                var reader = new BinaryReader(evt.data);
                var tag = reader.readString(26);
                //var txt = document.createTextNode(evt.data.toString());
                form1.txtMessage.appendChild(tag);
            };
            ws.onclose = function() {
                alert("Socket Closed!!!");
            };

            ws.onerror = function() {
                alert("WTF!");
            };
        }
    }

    function btnClose_onclick() {
        ws.close();
    };

</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:16:33+00:00Added an answer on May 31, 2026 at 1:16 am

    No, you have to create a separate script block for your code, or put it in the script file.

    <script src="BinaryReader.js" language="javascript" type = "text/javascript"></script>
    <script language="javascript" type = "text/javascript">
        var ws;
        function btnConnectSend_onclick() {
            if ("WebSocket" in window) {
                ws = new WebSocket("ws://localhost:35000/");
                ws.onopen = function() {
                    alert("Connection Open......");
                };
                ws.onmessage = function(evt) {
                    var reader = new BinaryReader(evt.data);
                    var tag = reader.readString(26);
                    //var txt = document.createTextNode(evt.data.toString());
                    form1.txtMessage.appendChild(tag);
                };
                ws.onclose = function() {
                    alert("Socket Closed!!!");
                };
    
                ws.onerror = function() {
                    alert("WTF!");
                };
            }
        }
    
        function btnClose_onclick() {
            ws.close();
        };
    
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to read binary data from a specific offset. I write the data
I am trying to read a binary file from a program that writes a
In my program, I am trying to read data from binary file, and then
I'm trying to read a binary file that is in the following format: number
Im trying to read some data from a binary file into a buffer allocated
I'm trying to write code to read a binary file into a buffer, then
I'm currently trying to read some binary data using the BinaryReader. I've created a
I am trying to read the number of line in a binary file using
I'm trying to read a .doc file into a database so that I can
I'm trying to read binary data in a C program with read() but EOF

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.