socat (SOcket CAT) – multipurpose relay – is a command line based utility that establishes two bidirectional byte streams and transfers data between them.
socat is #4 on the Top 100 Network Security Tools list, available in most distro repositories (on Debian/Ubuntu sudo apt-get install socat does the trick), really light on resources, and very efficient.
Sounds simple, does wonders!
- Every once in a while, I see people having a hard time accessing a RS232 or USB serial port from Java. There exist several solutions to do this in Java: The Java Communications 3.0 API looks awfully old and unmaintained. It is available for Solaris SPARC, Solaris x86, and Linux x86.
- ESP8266 serial bridge. (SKU256450) EUR 8.92). It has a CP2102 usb-serial adaptor. In this example, we use the ESP-12 module powered over a 5V USB cable. As the ESP8266 works in 3.3V, and most openwrt routers works on 3.3V TTL, it is not necessary to do any voltage conversion. Another way of using socat is to redirect the TCP to.
On the client computer the Linux tool socat comes into the game. It is a powerful program that can redirect data streams in general. Socat establishes bidirectional data streams between files, pipes, devices (serial line or a pseudo terminal) and different kind of sockets (UNIX, IP4, IP6 – raw, UDP, TCP and SSL).
Sidenote: socat is actually #71 on the mentioned list, but since socat is a much enhanced version of netcat, which is #4, it seems to me logical to count socat as #4 also.
One of the wonders you can do is creating pairs of “virtual” ports/interfaces/sockets etc., even hybrid pairs like port-socket, etc., where one (or both) ends of the pair can also be real objects. See socat man page for more details.
Creating pairs of virtual serial ports (VSP), is quite often wanted feature, yet it’s hard to find a solution online (try Googling it)… Pair of VSP’s is very useful to have esp. if you’re into embedded device programming, where many embedded development kits support debugging via serial link – PharLap in my case. Yes, it does have Ethernet debugging since ETS 14, but it’s a very unstable option.
Even if you’re using Ethernet debugging, it’s often much easier to have your embedded system in a virtual machine (VirtualBox, VMWare etc.), and do the debugging via virtual NIC.
• A fully functional Inertial Navigational System has been added which goes even further to adding to the realism of the flight. • New icons for both 2D and virtual cockpit management without any problems. • Analogue and tap instruments included for nostalgia and effect. • New baked textures that go an extraordinarily long way to making sure the aircraft looks real.
To cut the talk short, many thanks to Gerhard Rieger, author of socat, for the following tips!
To create a pair of VSP’s
and that’s it! As long as the socat is running, you have a pair of VSP’s open (their names are printed by socat on initialization). See socat man page for more details on what the above command does.
Connecting executable and VSP
where the executable myprog will be connected with the VSP through stdio.
Virtual network interfaces
In a similar fashion, you can create pairs of virtual network interfaces – tun/tap devices (again, this pair exists as long as the master process – socat – is alive):
Yes, that’s it, you’ve got a pair of virtual network interfaces!
- 1 Tell If Your Computer Has a Bluetooth Adapter Built Into it
- 2 Adjusting the Microphone in a MacBook
- 3 Open an IMG File in Windows 7
- 4 Update a Driver for a Dell USB Mouse
Some software and specialty hardware requires you to use a traditional serial port. Serial ports have been around for decades and work by transferring one bit of data at a time at a relatively slow rate. They're the precursor to the modern Universal Serial Bus, which has replaced them. This creates a problem. Since USB can do the same thing as many COM ports, most computers now lack serial ports. If you need one to satisfy your software, though, USB's benefits don't help you. The solution is to plug a USB to serial adapter into a USB port and set it to act as COM1.
Installing the Adapter1.
Plug the USB-to-serial adapter into an open USB port on your computer.2.
Insert your adapter's driver CD when you see a 'Found New Hardware Wizard' window appear on your screen.3.
Click the box next to 'Locate and install drivers software (recommended).”4.
Dismiss the Windows security warning, if it appears, by clicking 'Install this driver software anyway.' Depending on your computer's setting, you may be able to skip this step.5.
Click 'Close' when the installation process finishes.6.
Plug your serial device that needs to be on COM1 into the adapter's serial port.
Changing the Port1.
Point your mouse at the upper-right corner of the screen to open the Charms bar, and click on the Search charm.2.
Type 'Device Manager' into the search box. When it appears in the list of results, click on it to open it.3.
Click the box next to 'Ports (COM & LPT)' to expand the list of ports.4.
Right-click on the port that corresponds to the serial port added by your USB adapter. It may have the name of the adapter, its manufacturer, its chipset manufacturer, a caption like 'USB Serial' or the word 'COM' in its name.5.
Click 'Properties' in the drop-down menu, and then click the 'Advanced' tab in the Properties window.6.
Change the COM Port Number drop-down menu to say 'COM1.' Click 'OK.'
About the Author
Steve Lander has been a writer since 1996, with experience in the fields of financial services, real estate and technology. His work has appeared in trade publications such as the 'Minnesota Real Estate Journal' and 'Minnesota Multi-Housing Association Advocate.' Lander holds a Bachelor of Arts in political science from Columbia University.
- Jeffrey Hamilton/Digital Vision/Getty Images