Create virtual serial port programmatically - java

I want to create virtual serial port programmatically in c#,delphi or java and use this port for printer port. so this should created in ports(com & LPT) in device manager. but com0com create a new branch in device manager like "com0com - serial ports emulator" and does not display this port in printers ports list.how can i create virtual serial port programmatically that i can use this in printer ports.

Basically you cant in any of the languages you tagged .
In essence, you will need to write a device driver (i believe Delphi had a port for the DDK at one stage). Although this is not impossible, given the very fact that you asked this question here i'm guessing its a little bit above your level and a steeper learning curve than you might anticipate.
However, there are plenty of com port emulators floating about if you need to test against something. Just search google.

Related

Java Find Default Gateway IP (v4/v6), Windows/Linux/MAC for PCP

I'm trying to implement fully-automatic PCP (according to https://www.rfc-editor.org/rfc/rfc6887) for a decentralized P2P chat system.
That requires PCP configurations to be made, and so far I haven't found anyone having a library or framework for that. Now I'm trying to make my own, and here's the first hurdle:
How do I find the current system's Default Gateway IP on multiple OS types and if possible both IPv4 and IPv6.
I made myself a simple way of receiving and interpreting commands to the CLI of the host OS using
Runtime.getRuntime().exec("[COMMAND LINE]");
as Java itself seems to provide no such information, of if I don't know where.
The current plan would involve getting the ipconfig and ifconfig returns on Windows and Linux (for MAC i'm sure there is a similar command), then search for the keyword of "gateway" and find the next IPv4 and IPv6 addresses, then see if anyone answers there on UDP port 5351 after a few attempts. I'm fairly certain it could work, but before using try-and-error methods I want to look for a more professional solution.
On top of that it would be good having a way to find out if the system is inside a NAT. While it usually isn't a problem with the private A, B and C networks there always is the possibility of custom settings on the router like more configured private networks requiring NAT.

How could java sending data to 7segment display directly

I'm new to embedded systems,
could i send data from java application on my pc to serial 7 segment display direct via serial port or i have to use micro-controller in between
"TTL serial communication" probably means the same protocol used by a PC serial port, but at a different voltage.
You will be able to connect it to a serial port if you use a level shifter in between to convert the voltages. Search for "MAX232" chips, which are designed to do exactly this. There will be a bit of wiring involved. For more help with this part, try https://electronics.stackexchange.com/
On the software side, I don't know if Java has a way to access serial ports. There is probably a 3rd-party library to do this, but C might be better-suited anyway.

How do I communicate with a RS232 serial port on a remote device using TCP/IP?

I have a device connected using a serial port to GC-100-12. I want to connect to it remotely and pass commands to that device and retrieve replies from that device. I am capable of communicating if the device is connected straight to my laptop but I would like to allow for the device to not be physically connected as well.
I am using javax.comm to communicate with the serial device when connected locally.
EDIT:
It appears that the GC-100-12 I am using is an appropriate hardware solution as outlined by David. I simply opened a socket connection along with the port for the RS232 port and passed in commands as an array of bytes and voila!
You must use hardware solution. Something like this.
Given it's quite expensive, you may consider looking at Rasperry PI or even Arduino-based solution.

how to read virtual serial port of MIB520

i need to read from my Pc the serial port that connected with MIB520 usb board ?
if i know the sequence of the data received byte by byte then can i use C# or any tool to read this port ??
i have iris and MicAz motes that read gps packet then they send them to the mote which attached to the MIB520 usb board.
note: that MIB 520 use two virtual ports,it use FTDI FT2232C
This is a pretty general question about connecting to serial ports via USB, so I'll point you to some sources of general information.
First of all, your machine will need to have the FTDI drivers installed.
If you want to manually interact with the serial device by typing commands and reading responses, you can use a terminal emulator like minicom or gtkterm. This question has some related information in the answers.
If you are looking for a java serial library, there are several you could try:
RXTX
serterm: An example project built with RXTX
javax.comm
jSSC

BACNet plugin for Building Management System

I'm trying to get a BACNet scanner up on an Seimens server running the Apogee system with a BACNet interface. I've tried using BACNet4j put i get a port bind error on the LocalDevice object for test/Scan.java.
Does anyone know of any other libraries I could use or a reference to instructions for setting up a BACNet plugin to a building management system?
I have had the same problem before, i.e. the BACnet client needs to both send and receive from UDP port 47808. Since the BACnet server already uses that port to listen (and reply) my solution was to use a virtual IP (a bridge) so that my client runs on the same Ethernet card but with a different IP address. A bit convoluted, I know, but it works.
Whether or not the Apogee system supports virtual (or simply additional) network drivers is another question altogether. On my Linux and Windows machines I can run as many servers and clients as I need (I actually don't know what is the limit, I have run up to 5 servers and 3 clients without any problems).
Concerning the port bind error, you may have to configure your firewall because:
BACnet/IP is using UDP
the default port number is 47808 (0xBAC0)
Your issue might be the use of a (BACnet port #) socket that is already in-use; you have to ensure that it's not in exclusive-use - before binding to the socket, but also (slightly more) important, also ensure it's marked for reuse.
But unless you're listening for Who-Is broadcasts, I'd recommend listening for the (unicast) responses upon a different port #, e.g. 0xBAC1/47809, but still send upon the standard port # 0xBAC0/47808.

Categories