I've beed into a strange problem today and can't find anything to solve it the right way. I have a Java program that is started with /etc/rc.d/rc.local on Slackware 12.1. The program works perfectly. It have to send data on ttyS0 after some requests are made, but in the last installations I needed to send binary data instead of ASCII and this is not working for binary. When I restart the program by the shell, it works perfectly. It seems that there are environment variables or something that cause the RXTX library to enable or disable the canonical mode but can't find this and can't find any settings in RXTX to init serial port in the proper mode.
Thank you,
Alex.
EDIT :
I can simplify the question by asking : Where in Slackware are the serial port initialized to be used in ASCII mode by default? (In my case /etc/rc.d/rc.serial is mode 644 so not executed.
Related
I developed a java code to connect to a device and issue few POST commands. This runs well in eclipse. But when I build and run on command-line it always times out.
I am running eclipse in the same machine as command line .I am using java 8.
Network problems are best tackled by first keeping Java out of it. So as a first step, you can open up the console and try to do a telnet connection to the socket address you used in your program by entering
telnet targetserver.example.com 12345
If that times out as well, the source of your problem is not within Java.
You haven't provided much (e.g. source as requested) but my guess into the blue is that you're sitting behind a proxy that is configured in Eclipse. Eclipse passes that information to the started application so the connection works. Starting the application on the console lacks this information, so the network connection is attempted directly without going via the proxy.
Has anybody successfully interfaced Medical Lab devices like Cell Counters /ABG instruments to mirth connect using ASTM 1381-02 or similar protocols over serial port. I am working on a small project. I need the data transmitted by the machine in ASTM format to a text file/ to a database and I cannot afford to pay $30000 for mirth commercial support. I need a low cost or open source solution.
I was expecting MLLP listener to be off use but it seems to work with TCP and I have to make it work purely on serial communication.
Secondly
I tried writing ASTM serial data receiver in Java. But control characters such as ACK, STX, ETX, ETB, and other delimiters are not visible in terminals be it in Win 7 cmd or Netbeans/Eclipse console. Making me helpless in parsing the data.
Any help will in right direction be deeply appreciated.
If you are under Linux environment you may use COM port redirector to a given TCP port and use Mirth's TCP Listener to intercept that flow.
E.g., to pipe the serial port through netcat:
netcat ipaddress port < /dev/ttyS0
Or using socat:
socat pty,link=/dev/virtualcom0,raw tcp:ipaddress:port&
(check for correct parameters)
I recognize 2 problems:
First, is it possible to raise an ftp service on the windows PC? if so, you only need to create a file reader addressed to ftp to capture the txt with the ASTM.
Second, to determine the characters of start and end of message I recommend you read the information of the provider, if you do not have it available, I suggest you use notepad ++ to see the hidden features. I hope you help.
Just FYI there is a commercial extension available that provides ASTM E1381 support: https://www.nextgen.com/products-and-services/integration-engine?extension=astm-transmission
When I am running i am getting following exception repeatedly each time i try to run the program.
Several ports (8005, 8080, 8009) required by Liferay v6.1 CE Server
(Tomcat 7) at localhost are already in use. The server may already be
running in another process, or a system process may be using the port.
To start this server you will need to stop the other process or change
the port number(s).
I tired to increase my virtual memory(page size) and ram size. But it not workinge
Currently, I used win 7 64 bit, java jdk, jre 64 bit. I tried to change JDK,JRE (32 bit). However, the result is the same. :(
Can any one tell me how can i eliminate this error.
Either figure out which other program uses the ports that Liferay/Tomcat would like to use out of the box (most likely: 8080) and terminate it.
Or, in your liferay installation, locate the file tomcat-[version]/conf/server.xml, edit it with your favourite text editor and locate all the port instructions and change them to unused values - e.g. change "8080" to "9090", "8009" to "9009" and "8005" to "9005" (or anything else, the point is to find ports that are not yet in use)
After this, assumed that you made the choices I named above, connect to your Liferay installation at http://localhost:9090/ and have fun.
i am trying to connect serial port on ubuntu. However, It doesn't work for me. I succesfully run the same project on Windows just with different drivers. The problem is that I can't load any ports while I am using this:
CommPortIdentifier.getPortIdentifiers(); // i am using rxtx 2.1.7
It always return zero ports. I would like to use port ttyS0 whichworks great with minicon so i am sure that port is not blocked and the machine is not broken.
Anyone has a reason for this ?
It was just becouse low priviligies. I had to add myself to a group which is supposed to work with ttyS0.
I used this command
sudo chmod 666 /dev/ttyUSB0
I had the same problem and it worked the moment after I used this command. Like Smolda said, it is a permission problem.
if nothing helps, you should consider to add this line to your java code:
System.setProperty("gnu.io.rxtx.SerialPorts", "/dev/yourtty");
did it for me. (Only if you work with the RXTX library)
I need to receive and parse some SNMP traps (messages) and I would appreciate any advice on getting the code I have working on my OS X machine. I have been given some Java code that runs on Windows with net-snmp. I'd like to either get the Java code running on my development machine or whip up some Python code to do the same.
I was able to get the Java code to compile on my OS X machine and it runs without any complaints, including none of the exceptions I would expect to be thrown if it was unable to bind to socket 8255. However, it never reports receiving any SNMP traps, which makes me wonder whether it's really able to read on the socket. Here's what I gather to be the code from the Java program that binds to the socket:
DatagramChannel dgChannel1=DatagramChannel.open();
Selector mux=Selector.open();
dgChannel1.socket().bind(new InetSocketAddress(8255));
dgChannel1.configureBlocking(false);
dgChannel1.register(mux,SelectionKey.OP_READ);
while(mux.select()>0) {
Iterator keyIt = mux.selectedKeys().iterator();
while (keyIt.hasNext()) {
SelectionKey key = (SelectionKey) keyIt.next();
if (key.isReadable()) {
/* processing */
}
}
}
Since I don't know Java and like to mess around with Python, I installed libsnmp via easy_install and tried to get that working. The sample programs traplistener.py and trapsender.py have no problem talking to each other but if I run traplistener.py waiting for my own SNMP signals I again fail to receive anything. I should note that I had to run the python programs via sudo in order to have permission to access the sockets. Running the java program via sudo had no effect.
All this makes me suspect that both programs are having problem with OS X and its sockets, perhaps their permissions. For instance, I had to change the permissions on the /dev/bpf devices for Wireshark to work. Another thought is that it has something to do with my machine having multiple network adapters enabled, including eth0 (ethernet, where I see the trap messages thanks to Wireshark) and eth1 (wifi). Could this be the problem?
As you can see, I know very little about sockets or SNMP, so any help is much appreciated!
Update: Using lsof (sudo lsof -i -n -P to be exact) it appears that my problem is that the java program is only listen on IPv6 when the trap sender is using IPv4. I've tried disabling IPv6 (sudo ip6 -x) and telling java to use IPv4 (java -jar bridge.jar -Djava.net.preferIPv4Stack=true) but I keep finding my program using IPv6. Any thoughts?
java 16444 peter 34u IPv6 0x12f3ad98 0t0 UDP *:8255
Update 2: Ok, I guess I had the java parameter order wrong: java -Djava.net.preferIPv4Stack=true -jar bridge.jar puts the program on IPv4. However, my program still shows no signs of receiving the packets that I know are there.
The standard port number for SNMP traps is 162.
Is there a reason you're specifying a different port number ? You can normally change the port number that traps are sent on/received on, but obviously both ends have to agree. So I'm wondering if this is your problem.
Ok, the solution to get my code working was to run the program as java -Djava.net.preferIPv4Stack=true -jar bridge.jar and to power cycle the SNMP trap sender. Thanks for your help, Brian.