After using RXTX for a number of different projects, I've come across many annoying discrepancies and issues that can only sensibly be put down to bugs in the library - deadlocks, race hazards, and monitor threads deep in the RXTX library being left open preventing the program from closing (even though all ports I was using have been closed!) Running the latest "unstable" version has helped a bit, but it's still far from where I'd call it reliable, and activity on the project seems rather low at present.
However, searching for free cross-platform alternatives to RXTX doesn't seem to come up with much else.
Is there another library that anyone's tried with more luck? I don't need parallel port support, just serial, and it doesn't necessarily have to be compatible with RXTX or the javax.comm API.
We have moved to java-simple-serial-connector which seems to be very stable and comfortable at the current release 0.9.0. For now, it works on windows and linux systems. We use it for modem interactions.
There's jSerialComm too.
Serial communication in Java is a mess. I've had trouble with jSSC with a virtual usb serial on linux, but with serial-comm it connected.
RXTX is a mess.
At least I think that now this SO question has all of the worth mentioning serial communication java libraries.
There's a few of them out there now, now that Arduino is pretty popular.
There's Serialio
and PureJavaComm, but it's pretty early on in development from what I can see.
it really depends on what your needs are. RXTX has been ported pretty much everywhere, so it is widely available.
One of the issues of RXTX I faced was the delay closing the port. When checking with setserial the port configuration I discovered a parameter closing_delay=3000. This means that the port closes 3 sec after the close() method was executed. Resetting the closing_delay toany value is ignored by RXTX. RXTX insists in 3sec delay.
the JSSC library performed to our satisfaction
Serialio lib is $49/platform/developer seat which gets you unlimited distribution in unlimited apps so not too pricey. The Mac library has been stable and reliable for us in an undemanding application and availability/compatibility has been good throughout for the various Mac platforms and OS/X releases.
I use socat configured to serve a socket for a serial port.
The downside is that baud rate etc. is given to the socat invocation, it is not something you can readily alter from your program.
On the upside is I can connect across a network without anything more than changing the IP address I connect to.
jSerialCom is good !
'https://github.com/Fazecast/jSerialComm'
And here is its' wiki pageļ¼ https://github.com/Fazecast/jSerialComm
Related
I making a windows application that needs to use Bluetooth for communication so far as now I have tried blue cove for Java.
It seems to be limited to few stacks only.. I have a Toshiba stack, but I still want a library that could handle most popular stacks.
Doesn't matter if its for C, C++ or Java.
Bluecove is already as good as it gets.
This is due to the unfortunate fact of how Bluetooth is handled on Windows. Instead of agreeing on a single implementation for the whole platform, vendors tend to ship their own stack with the device driver software. This is partly due to historical reasons and partly because hardware vendors don't care enough about this to do anything about it.
Bluecove provides implementations for the Microsoft, Broadcom WIDCOMM and BlueSoleil stacks, which should cover >90% of all available devices. In your case, I see three options:
Try to get your device to work with a different stack. I know for a fact that BlueSoleil works with certain Toshiba-based devices, google should give a good overview of the options for your specific device.
Get another device. Bluetooth dongles are ridiculously cheap these days, so this is a valid option. It's a bit more messy than using a build-in device, but then again, what good is a build-in device if the software doesn't work?
Try to write an implementation for Toshiba devices for Bluecove yourself. IIRC Toshiba does provide an SDK upon request. You might run into legal issues though if the license forbids integration with Bluecove in some way.
Morale of the story: Bluetooth drivers are a mess, especially on Windows. Be sure to check your software's requirements before you buy your next device.
As we know the Sockets Direct Protocol (SDP) provides access to high performance network connections, such as that provided by InfiniBand
can any one please give me any good example of how can i use Sockets Direct Protocol (SDP) of java ?
If you are running a recent version of Solaris or OpenSolaris I think you are all set to try stuff out.
Linux requires use of the libsdp library and external kernel modules available from OpenFabrics (OFED), there seems to be strong desire to get the modules into Linux mainline but OFED guys seem to be rubbing the kernel developers up the wrong way over some of the issues involved.
There's a useful setup guide for Infiniband under Debian Linux which gives details on how to set up and compile the OFED kernel modules and the libsdp library etc. Once you have that done you can follow the SDP section of that how-to in order to get SDP working and tested.
After that I think it is as simple as getting a recent JDK7 snapshot, currently at M12, and trying stuff out. Set up your config and create connections between addresses specified in your SDP config, all done via the same APIs as network sockets, i.e. Socket for 'old' IO, and SocketChannel for NIO (or even AIO in JDK7 :). As far as I can see, once you have followed the set up guides and configured the addresses that will use SDP the JVM will use SDP based Sockets/SocketChannels whenever you provide addresses within the SDP mapped range. So your existing networking code that uses sockets should be able to use the SDP connections transparently, just at blazingly fast speeds and tiny latencies.
Windows users are out of luck for the time being, as far as I can tell.
Also:
Alan Bateman's SDP blog entry (Oracle JDK SDP lead)
The ways to reduce startup time of Java and Scala applications have been already discussed here and here. One of the solutions suggested there was to use client-server approach with either Nailgun or a simple hand-written server communicating through a TCP socket with netcat.
On the one hand, Nailgun is designed for this purpose. On the other hand, its last release 0.7.1 was in 2005 and I am a bit worried if the development has stopped and how stable it is. netcat seems to be a pretty standard tool and available on many Linux/Unix systems. But both these systems are new to me so I would like to know if my observations are right and what are the other advantages and disadvantages of using Nailgun vs netcat to provide fast command-line interface to a Java application?
P.S. You may wonder why to improve the startup time since it is already quite reasonable (~100ms on my machine) or why not to use say C/C++ instead. The first is because the application will be executed many times (e.g. from a loop in a bash script) and this use scenario cannot be changed unfortunately, the second is because this console program will be just an alternative interface (CLI) to the existing piece of software written in Java.
My recomendation would be to go now with nailgun and to prove that this kind of solution really has an positive effect of starting time.
If you have confirmed that the bottleneck is the startup time then you may implement a very simple client/server with the advantage to be free to use any comunication program (netcat, wget, curl, perl, etc) and to have full control over the protocol.
"Before you download it, be aware that it's not secure. Not even close. Although there are means to ensure that the client is connected to the server from the local machine, there is not yet any concept of a "user". Any programs that run in Nailgun are run with the same permissions as the server itself. You have been warned."
I would personally like to have that fixed before putting it into production...
Nailgun works well and Netcat works well too. I have used both. Netcat is suitable for any programs, not just Java. It can be used to execute say shutdown scripts across your LAN. For Windows you may just have to use Nailgun.
I am planning on implementing a NIDS (Net Intrusion Detection System) in the Java programming language.
After searching, I found two libraries for this.
1) Jpcap
2) jNetPcap
Which one should I use and why?
Which is more preferable to use?
It appears development has stopped on Jpcap. Their last release was 2007. In contrast, jNetPcap has had very recent releases. The underlying libpcap C library that they both wrap has continued to evolve, so I would go with jNetPcap for that reason.
On the other hand, libpcap is a fairly simple API. If you are comfortable with C, then you may gain performance advantages by using the library directly instead of going through a Java wrapper. Something to consider, anyway.
One simple idea I've had for network intrusion was to listen for messages on the braodcast IP address. New comers to the network may likely need an IP address from the DHCP server. If this is so, then they will have to send out a broadcast that a DHCP server will respond to . You could write a program that sits on client A and displays popups whenever it hears something on the broadcast address.
If it's still an issue, use .NET version jnetpcap. I built a NIDS for a master's term project and I tried to use Java and get jpcap and similar working but it was near impossible. So I went for the most viable option c# and it worked alot easier, even thought I didn't know it then.
Also use ikvm since you will need to use weka.jar from .NET as well.
In a previous SO question, it was mentioned that USB devices can be mounted using the following approach in Windows:
MOUNTVOL C:\USB: \\?\Volume{ebc79032-5270-11d8-a724-806d6172696f}\
My question is what is that String starting with \\?\Volume called, and what is the best way to retrieve that. I would rather not use .NET if possible since you can't really 'bundle' the .NET runtime without physically installing it on the machine as far as I know.
I would also be interested in using JNA if that is possible.
You can't bundle the Java "...runtime without physically installing it on the machine..." either.
Enumerating the device after it is mounting should be straightforward. Actually mounting the device should NOT be straightforward since Java (and .NET) are both designed to abstract away the hardware.
I recommend that you pick a more appropriate tool for this. Either choose to simply invoke another process to run the mount command (knowing that it won't be portable), or choose a tool that does not abstract away the hardware, or at least less so (perhaps Python?).
EDIT: Clarification on JVM install...
Excellent point--a JVM installation can be much less invasive than a .NET installation since the latter MUST integrate with the OS while the former merely CAN integrate with the OS. So, yes, including a private JVM install is viable and perhaps desirable.
NOTE: The question includes the mount command for the USB device, which tends to emphasize that aspect as a primary requirement.
What kind of USB device are you looking for? The bit you quote is only applicable to USB disk drives, not USB devices in general.