[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Web Interface for serial port Access

Posted on 2005-04-14
9
Medium Priority
?
657 Views
Last Modified: 2008-03-17
Hello Experts,

I am writing a web application in php, here is the problem,
I have a java program which communicates with the serial port of the system and do some message sending and recieving.
My problem is to make it possible for the user to communicate the serial port through web interface (that i have made in php sofar). As we know the php is a server side scripting language. i am not able to use that to communicate with the remote serial port.

Is there any way i can provide some kind of web interface so that user can access their serial port through browser. (possibly make use of existing java program but not necessarily)

I am new to the web development and would appreciate very much any guidence towards the solution.

thank you in advance.
0
Comment
Question by:aze_kool
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 7

Expert Comment

by:Promethyl
ID: 13787300
Why not pass information to the java program? Is it a servlet? Applet? Either by simple text file or invoke over web, xml, something>?

0
 

Author Comment

by:aze_kool
ID: 13790208
thanks for reply,
Infact its a simple java programed developed for windows. not an applet or servlet.
How could i pass the information to the java program this way. since the java program would additionally  connect to serial port and send some commands which is supposed to be passed through web interface and recieve some information which i would need to show to  web user as well.  
0
 
LVL 7

Expert Comment

by:Promethyl
ID: 13790293
Well, let's see... If both programs reside on a box, you can have the java program scan for a file on the hard drive, and use that for it's communication in. Seperate file for out. Seems bad though..  Uhm..

You could have the java program request data from the web program and push and pull in that fashion.

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Accepted Solution

by:
mustfah earned 1000 total points
ID: 13797519

if /dev/ttyS0 is your serialport, you could simply read  it by

<?php
system("echo -n 'string to send' > /dev/ttyS0");
?>

or

<?php
$fp = fopen ("/dev/ttyS0", "w");
echo fput ($fp,128);
?>

 and you can write to the port using

<?php
$fp = fopen ("/dev/ttyS0", "r");
while (!feof($fp))
        {echo fgets ($fp,128);
        }
?>
you need proper permissions set for /dev/ttyS0
0
 

Author Comment

by:aze_kool
ID: 13800388
Will it work for the Remote client serial port?. :)
and i think for the windows client it seem not to work.
0
 
LVL 2

Expert Comment

by:mustfah
ID: 13821971
it will work with your servers port..

try to search for a  tool that will let u convert serial port sream to web socket stream,,,


0
 
LVL 2

Expert Comment

by:mustfah
ID: 13822021
for client remote ports .

http://www.easyvitools.com/articles/webscript.html


regards
0
 
LVL 14

Expert Comment

by:huji
ID: 15989377
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
Accept: mustfah {http:#13797519}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Huji
EE Cleanup Volunteer
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses
Course of the Month19 days, 13 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question