I managed to create a Client in
Javascript
which opens a communication channel with a local server (implemented in
C
)via using
Namedpipes
.
The following is how to open a
NamedPipe
in plain
javascript
:
var object = new ActiveXObject("Scripting.FileSystemObject");
var file = object.CreateTextFile("\\\\.\\pipe\\myPipeName", false);
The server should be listening to any newly created Namedpipe which carries the specific name
\\\\.\\pipe\\myPipeName
In order to Write Data (In
STRING
Format) to the connection, you use the following piece of code:
var request = "Message to be Written to PIPE";
file.WriteLine( request );
As you can see, this method enables you to only send and receive data in
STRING
format since
javascript
doesn't allow full utilization of raw data (data in Raw format, Bytes, Words, Binary Format). However, when required to manipulate raw form data, i suggest you take a look at
Javascript Typed Arrays. They don't always function the way you'd like them to! One thing i am still trying to figure out is, how the client can read Messages being sent from the server.
I am pretty sure this isn't the best way to do it, however it worked for me.
Any better suggestions are always welcomed! Enjoy!