Reading a weighting scale socket in zsh - sockets

We use zsh shell on a macbook and try to read the output of some weighting scales with sockets on 10.0.117.14 Port 8884.
I could not make zsh/net/socket commands to work in any way on my mac.
I tried for example
pierrefroelicher#mbAir2021pcf ~ % nc -z 10.0.117.14 8884 pierrefroelicher#mbAir2021pcf ~ %
and nothing happened.
I do not know if I have to install a "module".. And what command to use.
I tried and pierrefroelicher#mbAir2021pcf ~ % nc 10.0.117.14 8882 4p000064000000`
Gives the weight.. here for example 640g..
however it opens a TCP connection to the scale and blocks the port.
telnet, after installing brew install telnet also works
pierrefroelicher#mbAir2021pcf ~ % telnet 10.0.117.14 8882
Trying 10.0.117.14...
Connected to 10.0.117.14.
Escape character is '^]'.
^Zexit064000000
But.. I now would like to do this in curl.. would like to have not a stream.. but a one time read.. and then liberating the port..

Related

Oracle VirtualBox VM network not working

I am attempting to set up a VM using VirtualBox. I am hosting on Windows 10 and want to set up a CentOS vm. I have a VM running but have had problems getting network connectivity with it. I have no experience with VirtualBox and it has been a long time since I worked on Linux. Any ideas on what I need to do to correct this? Are there some steps I need to take during the creation of the image?
Image is : CentOS-7-x86_64-Everything-1708.iso
VirtualBox : Version 5.1.28 r117968 (Qt5.6.2)
When I try to ping anything I get " connection the Network is unreachable
The very best thing you should do is running the following command:
ifconfig -a
Then, If you have an interface listed (not just 'lo'), you can do that:
# cd /etc/sysconfig/network-scripts/
# sed -i -e 's#^ONBOOT="no#ONBOOT="yes#' ifcfg-{{network_device}}
replace {{network_device}} for your default network_device (from ifconfig-a command).
Then restart and it should connect.

port forwarding in raspberry pi on debian

I want to forward incomings from 192.168.1.50:5007 to 10.1.1.117:5007 on raspberry pi debian installed . I do not want to make a bridge between two networks. How can I achieve this?
You can use ssh:
ssh -L 192.168.1.50:5007:10.1.1.117:5007 -N localhost
this assumes that your server is the machine at 192.168.1.50. if not, you're going to need to give me the IPs of all the machines involved and tell me which is which.
You'll need sshd running but you should already have that with Raspbian.
After you run it, you'll need to authenticate. No forwarding will occur until then.
Once you've logged in, it will look like it's hung, but it's not; it just doesn't have any output to show you.
At this point the forwarding is active.
You can kill it with ctrl-c when you're done.
If you'd rather keep it running in the background instead of having an empty window sitting around, you can use ctrl-z (which will pause its execution) followed by bg which will resume the process in the background.
To stop the forwarding from a backgrounded job, you're going to have to find the pid in ps and kill it.
Run netstat -ano --tcp |grep 5007 to see your server listening for connections on 192.168.1.50:5007, remote computers making connections to 192.168.1.50:5007, and new connections from your server to 10.1.1.117:5007

Data Transmission Stop from Raspberry Pi

I am trying to establish a communication b/w raspberrypi(Raspbian) and PC(Microsoft XP) through GPIO PINS 14(Tx) and 15(Rx) for sending/receiving data... , RS-232 level converter is using for connection of GPIO to PC serial COM port and Voltage conversion from 3.3V to 12V...
I install minicom (Echo ON) at raspberry side and install Teraterm(ECHO OFF) at PC side.
Whatever I typed on minicom, it successfully appear on Minicom and Teraterm but when I tried same thing on Teraterm, it only appears on Teraterm not on minicom and also blocked by minicom (/dev/ttyAMA0). After that I am not able to send data from minicom to Teraterm.
But I just check one thing more and very surprise that, when shorting GPIO PIN 14& 15 together and starting typing on minicom... it just show me one character and stop after that...
Again I repeat whole process by closing/opening minicom, again it just show character and then stop.
Can you plz guide me why it happening and how do I resolve it?
I just read from this link that someone was also facing your kind of problem but not exactly what you are facing.
It is happened because Kernel takeover the control on console so It is good and very important to disconnect the connect of console and kernal from the startup.
Now you can follow these step, I am sure you will get rid from this trouble...
Start editing this file by this command
sudo vi /boot/cmdline.txt
Originally it contained:
dwc_otg.lpm_enable=0 rpitestmode=1 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
deleted the two parameters involving the serial port (ttyAMA0) to get the following:
dwc_otg.lpm_enable=0 rpitestmode=1 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
rebooted (sudo reboot) to confirm that kernel output was no longer going to the serial port. But the serial console was still available. So edited /etc/inittab:
sudo vi /etc/inittab
commented out the following line:
2:23:respawn:/sbin/getty -L ttyAMA0 9600 vt100
Finally, rebooted again and confirmed that nothing was touching the serial port anymore. Then, to test it out installed minicom on the Raspberry Pi:
sudo apt-get install minicom
And ran it:
minicom -b 9600 -o -D /dev/ttyAMA0
After, it is able to send data in both directions!

Netcat: using nc -l port_number instead of nc -l -p port_number

This question is following this one: Sockets working in openSUSE do not work in Debian?
When working with sockets on my Debian system, I have to use nc -l -p port_number to simulate the server I want to talk with. If I'm using nc -l port_number, it will fail when using the socket connect function and strerror(errno) will say "Connection refused".
Netcat without -p option is working great on other Linux distributions, what should I change on my configuration?
Do not adjust your set. There are multiple implementations of netcat out there; not all of them behave the same.
In particular, the "traditional" version of netcat, which is probably what you have installed on your Debian system, will end up doing something totally unexpected if you omit the -p ("port") flag: it will end up treating the last argument as a hostname, pass it to inet_aton(), which will convert it to a nonsensical IP address (e.g, 1234 will become 0.0.4.210), and will then proceed to ignore that IP address and listen on a socket with an automatically assigned (probably random) port number.
This behavior is obviously silly, so some other implementations of netcat will assume you meant -p. The one you're using doesn't, though, so pass the -p option.
I agree with duskwuff that it is better to just use the -p option everywhere, but to answer your question:
The one thing you have to do is install a netcat that supports the syntax you want. I know the netcat-openbsd package supports it. I know the netcat-traditional package does not. There's also a netcat6 package, which also doesn't. You can then explicitly request the OpenBSD version of netcat like so:
nc.openbsd -l 4242
Optionally you may use the alternatives system to set this version of netcat to run when you issue the nc command:
update-alternatives --set nc /bin/nc.openbsd
This will be done automatically for you if this is the only netcat you've installed.
Finally, you may, again optionally, remove the netcat you don't like (netcat-traditional or netcat6).

OpenOffice, listen socket (Windows XP)

How can I make OpenOffice 3.2.1 to listen a socket (Windows XP)?
I used
soffice "-accept=socket,host=localhost,port=12345;urp;"
or
soffice "-accept=socket,host=localhost,port=12345;urp;StarOffice.ServiceManager"
Have tryed different ports..
OOo starts, but netstat doesn't show any connection with such port number.
I thought it's because of some turned off win services on my machine
, so I tryed the same thing on another computer - no results
Searching google etc. it seems that I'm the only one with such a problem %) It looks strange..
You need to give netstat -a flag to see listening ports.