Cannot receive UDP packets on Windows 10 from Ubuntu 16.04 - windows

My Windows (130.203.223.236) and Ubuntu (130.203.223.228) systems are on the same network. I'm able to ping one from the other. I want to transfer information between these two systems using UDP. I can send data from Windows to Ubuntu using the code below:
Running on Windows:
# This module provides access to the BSD socket interface. It is available on all modern Unix systems, Windows, Mac OS X, BeOS, OS/2, and probably additional platforms.
import socket
# port details to send data to Ubuntu
send_host = '130.203.223.228'
send_port = 5001
# we made a socket instance and passed it two parameters. The first parameter is AF_INET and the second one is SOCK_DGRAM. AF_INET refers to the address family ipv4. The SOCK_DGRAM means connection oriented UDP protocol.
send_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
while True:
send_sock.sendto("Welcome", (send_host, send_port))
print('Data Sent')
Running on Ubuntu
# This module provides access to the BSD socket interface. It is available on all modern Unix systems, Windows, Mac OS X, BeOS, OS/2, and probably additional platforms.
import socket
# UDP port details, to receive data from Windows
receive_host = '130.203.223.228'
receive_port = 5001
receive_buffer_size = 1024
# Create socket connection to receive data from Windows
receive_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
receive_sock.bind((receive_host, receive_port))
while True:
data, addr = receive_sock.recvfrom(receive_buffer_size)
print('Data Received', data, addr)
But I couldn't send data from Ubuntu to Windows using
Running on Ubuntu:
# This module provides access to the BSD socket interface. It is available on all modern Unix systems, Windows, Mac OS X, BeOS, OS/2, and probably additional platforms.
import socket
# UDP port details, to send data to Windows
send_host = '130.203.223.236'
send_port = 5002
# Create socket connection to send data to Windows
send_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
while True:
send_sock.sendto("Welcome", (send_host, send_port))
print('Data Sent')
Running on Windows:
# This module provides access to the BSD socket interface. It is available on all modern Unix systems, Windows, Mac OS X, BeOS, OS/2, and probably additional platforms.
import socket
# port details to receive data from Ubuntu
receive_host = '130.203.223.236'
receive_port = 5002
receive_buffer_size = 1024
# we made a socket instance and passed it two parameters. The first parameter is AF_INET and the second one is SOCK_DGRAM. AF_INET refers to the address family ipv4. The SOCK_DGRAM means connection oriented UDP protocol.
receive_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
receive_sock.bind((receive_host, receive_port))
while True:
try:
ego_data, addr = receive_sock.recvfrom(receive_buffer_size)
print('Data Received', ego_data, addr)
except socet.error as error:
print(error)
There are no errors while running the code

Related

Error: no device found Error: unable to open ftdi device with vid 0403, pid 6010, description '*' When trying to debug ESP32-S3 on macOS

Trying to debug ESP32-S3 with PlatformIO on VSCode with macOS on M1.
Installed ftdi drivers from their website. (installed the VCP drivers, not the D3XX ones as I couldn't find a way to compile and install them).
As ESP32-S3 has an internal debugger, I just created a USB that connects D-/D+ pins to the board gpio 19 and 20 (and grd). BTW, when I connect it to the macbook, I dont see any additional port under /dev/*
Getting the following error, regardless of my platform.ini configuration.
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz
adapter speed: 5000 kHz
Info : tcl server disabled
Info : telnet server disabled
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6010, description '*', serial '*' at bus location '*'
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6014, description '*', serial '*' at bus location '*'
.pioinit:11: Error in sourced command file:
Remote connection closed
My platformio.ini:
[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
upload_port = /dev/cu.wchusbserial553C0085431
monitor_speed=115200
build_type = debug
debug_init_break = tbreak setup
;debug_tool = esp-builtin
debug_tool = esp-prog
Removed and installed the ftdi drivers.
Got a similar error when trying with ESP-IDF.
Any thoughts?
If you are connecting the USB conector directly on esp32s3 module, you should try to change the board parameter from esp32-s3-devkitc-1 to esp32s3-builtin. This way you specify that you are using the built-in debugger.

ZeroMQ epgm error on Centos:93 Protocol not supported

I'm trying to multicast using zmq on Centos. My program dies on the line that tries to bind to the epgm address.
here is my code segment
pContext = zmq_ctx_new();
pPubSocket = zmq_socket(pContext, ZMQ_PUB);
std::stringstream ss;
ss<<"epgm://*:"<<port;
auto ret = zmq_bind(pSubSocket,ss.str().c_str());
if bind with the unicast such as "tcp://*", it can work fine,
but bind with the multicast epgm, the code will return 93, which means Protocol not supported
os:centos
language:c++
I have installed openpgm-5.2, zeromq4.0.5, and I have enabled the --with-pgm options when build the zeromq by command:
./configure --with-pgm=libpgm-5.2.122~dfsg
Please suggest me why is this still happening so...and how to solve this ?

BlueZ: No default controller available

I'm setting up Linux device to act as BLE host, and ESP32 to work as a BLE controller over UART.
I'm using BlueZ v5.55, with btattach and bluetoothctl utilities, and bluetoothd running in the background. However, after finishing the setup bluetoothctl still says No default controller available.
# /usr/bin/btattach -B /dev/ttymxc1 -S 921600 --protocol h4 &
# Attaching Primary controller to /dev/ttymxc1
Switched line discipline from 0 to 15
Device index 0 attached
# /usr/libexec/bluetooth/bluetoothd
# bluetoothctl
Agent registered
[bluetooth]# power on
No default controller available
Output of btmon:
# btmon
Bluetooth monitor ver 5.55
= Note: Linux version 5.4.8 (armv7l) 0.258161
= Note: Bluetooth subsystem version 2.22 0.258269
= New Index: 00:00:00:00:00:00 (Primary,UART,hci0) [hci0] 0.258314
# MGMT Open: bluetoothd (privileged) version 1.14 {0x0001} 0.258357
Output of dmesg during kernel start:
# dmesg | grep Blu
[ 0.643821] Bluetooth: Core ver 2.22
[ 0.644222] Bluetooth: HCI device and connection manager initialized
[ 0.644528] Bluetooth: HCI socket layer initialized
[ 0.644622] Bluetooth: L2CAP socket layer initialized
[ 0.645069] Bluetooth: SCO socket layer initialized
[ 4.678559] Bluetooth: HCI UART driver ver 2.3
[ 4.683346] Bluetooth: HCI UART protocol H4 registered
[ 4.688821] Bluetooth: HCI UART protocol LL registered
The ESP32 is running UART HCI controller firmware: https://github.com/espressif/esp-idf/tree/master/examples/bluetooth/hci/controller_hci_uart
The host is running a Buildroot-created Linux with BR2_PACKAGE_BLUEZ_TOOLS=y and a kernel with CONFIG_BT=y, CONFIG_BT_LE=y, CONFIG_BT_HCIUART=y, CONFIG_BT_HCIUART_H4=y.
I have 4 UART lines connected TX->RX, RX->TX, RTS->CTS and CTS->RTS.
I have checked the UART communication with the same HW setup - I can exchange data over UART with the ESP32 (in both directions).
The commands are run as root.
What am I missing here?
If you have any decent documentation on BlueZ HCI setup, I'll be happy to see it.
EDIT: I also installed hcidump and hciconfig (normally deprecated in BLueZ v5.55). Here is a log from hcidump:
# hcidump
HCI sniffer - Bluetooth packet analyzer ver 5.55
device: hci0 snap_len: 1500 filter: 0xffffffff
< HCI Command: Read Local Supported Features (0x04|0x0003) plen 0
< HCI Command: Read Local Version Information (0x04|0x0001) plen 0
< HCI Command: Read BD ADDR (0x04|0x0009) plen 0
(in 2nd terminal)
# hciconfig hci0 up
Can't init device hci0: Connection timed out (110)
After a few days, I have found a solution of this problem.
I have also used nRF52 DK as an alternative to better understand if the problem lies on the side of ESP32 controller, or on the side of Linux host. Because the nRF HCI UART worked on Ubuntu 20.04, but didn't work on my embedded Linux, I looked deeper on the Linux host side.
After starting BlueZ daemon with
bluetoothd -n
it showed more details:
bluetoothd[593]: src/adapter.c:get_static_addr() Failed to open crypto
bluetoothd[593]: No Bluetooth address for index 0
Which led me to this topic: https://github.com/raspberrypi/linux/issues/3628
It turns out, when attaching the UART HCI controller with btattach, BlueZ was not able to create a static address, because of missing Linux kernel crypto interface in user-space.
I compiled the kernel with additional configs:
CONFIG_CRYPTO_USER
CONFIG_CRYPTO_USER_API
CONFIG_CRYPTO_USER_API_AEAD
CONFIG_CRYPTO_USER_API_HASH
CONFIG_CRYPTO_AES
CONFIG_CRYPTO_CCM
CONFIG_CRYPTO_AEAD
CONFIG_CRYPTO_CMAC
After that change, I was able to attach the Bluetooth controller to my Embedded Linux host.

Cannot listen to any TCP port on macOS Big Sur with app Proxifier: protocol wrong type for socket

Environment
macOS Big Sur 11.0.1 (20B29)
System Firmware Version: 1554.50.3.0.0 (iBridge: 18.16.12561.0.0,0)
MacBook Pro (15-inch, 2019) (MacBookPro15,1)
Using Proxifier (edit: resolved because of this. see answer below)
$ uname -a
Darwin MacBook-Pro.local 20.1.0 Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:11 PDT 2020; root:xnu-7195.50.7~2/RELEASE_X86_64 x86_64
Problem
When tried to listen to any TCP port (tried TCP ports like 1, 80, 5555, 10000, 60000) system complains
Protocol wrong type for socket
Where specifically, with netcat:
$ nc -v -l 5555
nc: listen: Protocol wrong type for socket
and with Go code (go version: go version go1.13.7 darwin/amd64):
package main
import (
"net"
)
func main() {
_, err := net.Listen("tcp", ":80")
if err != nil {
panic(err)
}
}
$ go run main.go
panic: listen tcp :80: listen: protocol wrong type for socket
Any help will be much appreciated! I can't do any development now on my Mac :(
Ummmm ok this is embarrasing... Turns out that all of this is because I'm using Proxifier. Quitting the app resolved this problem.
I'll leave this here for anyone who fallen in this lol. :D
Update: Proxifier seems to be aware of this issue (see here). Turns out to be "a bug in Network Extension API" and Apple haven't been fixing it since September...
Workarounds proposed by Proxifier (ref)
Start affected applications before Proxifier start
Or bind the socket to 127.0.0.1, not to 0.0.0.0
It seems that the problem has been fixed by Apple in Big Sur 11.1 beta.
The bug affects all applications that use NETransparentProxyProvider.
https://developer.apple.com/forums/thread/661610
It is not a fault of Proxifier.
But it is a proxifier bug, since it should leave Direct connections alone - which it doesn't.

Windows doesn't automatically find local devices

I have a local network with a printer, laptop, desktop and a Raspberry Pi that acts as SMB NAS + Kodi + Pi-Hole + a whole lot more.
For a very long time my PC (Win10-latest) would not automatically find some other local network attached devices. The only ones that it would find would be Printer, Router and Kodi (streaming + library).
If I tried mapping a network drive manually or tried to access the local IP of device manually, it would work and then the device would appear under network. (workaround but still annoying)
I have tried all the solutions I could find online to enable automatic discovery with no luck:
Set WiFi to be private
Enable sharing + discovery
Make sure workgroup is WORKGROUP
Manually enable UpNP, SSDP + 2x Function Discovery services
Check firewall settings and allow File and Printer Sharing (LLMNR-UDP-In) for Domain
Weird thing is, my Android phone with SolidExplored had no problem finding other local devices including the SMB.
Eventually I tried the net view command and it came up with:
net view
System error 384 has occurred.
You can't connect to the file share because it's not secure. This share requires the obsolete SMB1 protocol, which is unsafe and could expose your system to attack.
So I checked smbstatus on my Raspberry and it said it is connected with SMB3_11. I then manually modified my smb.conf file on the Raspberry to be server min protocol = SMB2 but the System error 384 continued.
I then enabled SMB 1.0/CIFS File Sharing Support from Turn Windows Features on or off restarted my PC and all my local network devices appear!
I would like to know if anyone else experienced the same issues? I don't even understand what I have misconfigured.
# Global parameters
[global]
log file = /var/log/samba/log.%m
logging = file
map to guest = Bad User
max log size = 1000
obey pam restrictions = Yes
pam password change = Yes
panic action = /usr/share/samba/panic-action %d
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
passwd program = /usr/bin/passwd %u
server min protocol = SMB2
server role = standalone server
unix password sync = Yes
usershare allow guests = Yes
idmap config * : backend = tdb
guest ok = Yes
[homes]
comment = Home Directories
create mask = 0775
directory mask = 0775
read only = No
valid users = %S
[printers]
browseable = No
comment = All Printers
create mask = 0700
guest ok = No
path = /var/spool/samba
printable = Yes
[print$]
comment = Printer Drivers
guest ok = No
path = /var/lib/samba/printers
[R]
comment = 8Tb HD Raspberry Downloads
create mask = 0775
directory mask = 0775
force group = pi
force user = pi
path = /media/pi/Raspberry/Downloads/
read only = No
wide links = Yes
[Private]
comment = 8Tb HD Raspberry Private
create mask = 0775
directory mask = 0775
force group = pi
force user = pi
guest ok = No
path = /media/pi/Raspberry/Private/
read only = No
wide links = Yes
The issue was missing wsdd. Installed it, setup a systemd service with a few changes and all works perfect now.

Resources