Parallel port access from Java on XP

mattg2k4

Gawd
Joined
Sep 24, 2002
Messages
829
I want to write a program in Java to control an HD44780 text LCD from the parallel port. I want to use Java for portability, ease in GUI creation, and because it's the language I'm studying right now.

I can use the JNI to write a DLL in C++ which gives access to the port, but on NT, 2k, and XP there is the added difficulty in bypassing the protected mode. For a regular .EXE program I can use PortIO or a similiar program which will give that program access to the necesary ports. But, Java programs of course don't have executables. Is there any way I can get direct access to the parallel port from Java?

Thanks!
 
Fon't have a direct solution, but a workaround could be to use a pair of applications, one in C++/VB/whatever that you can easily access the parallel port with and another in Java for the GUI, using sockets to communicate between them.

As a side benefit, you could write to your LCD remotely (or you can lock it down to only work on the local machine, if you don't want to bother with the hassles of secure network communication).
 
That sounds interesting, but I don't know the first thing about sockets, or what they do.

Do you have any good links on it?
 
Well, if you use an MS product (VB, VB.NET, C#, VC++, etc.) to make the exe, you can find plenty of info on socket programming here: www.msdn.com

As far as Java goes, a good textbook should have socket programming located somewhere in the later chapters.

I have both VB6 and VB.NET code stashed away somewhere I can dig up if you'd prefer to look at something other than what MSDN has, but I wouldn't necessarily recommend looking at my code... the MSDN stuff is probably better as an example.
 
I found the Socket section of my Javanotes e-book (my class's main textbook), and it looks like a great way to do it, plus it will open interesting possibilities for putting LCDs on things like my fileserver which is run without a monitor, since if I understand correctly, remote and local administration would be almost one and the same. I think I should be able to make a simple C++ program that sits in the background and just converts communication over the socket to parallel port communication. I'll handle all of the higher level stuff in the Java app to make porting simpler.

One question about it, since socket communication takes place over a networking port, would it be a problem for the client and server socket to coexist on the same computer? I wouldn't think there would be, but I want to be sure before I get too far into this.

I should have the design more or less finalized this weekend, hopefully I can go to coding Sunday or the following week.
 
Originally posted by mattg2k4
...

One question about it, since socket communication takes place over a networking port, would it be a problem for the client and server socket to coexist on the same computer? I wouldn't think there would be, but I want to be sure before I get too far into this.

...

No problem. You just make sure to use different port numbers for them. You don't even need a network card, as you can use localhost.
 
Back
Top