I'm trying to send UDP packets over the t-mobile NB-IoT network using AT-commands on a SIM7020E chip. I used the product wiki as reference. The starter version of the sim card I have doesn't support TCP, but I'm planning on using that later if I can succesfully communicate using UDP.
I created a UDP-socket on a Raspberry Pi using "nc -u -l 9999". I set an A-record on my hosting provider to refer dev.mydomain.com to the IP address of the Raspberry Pi. I verified the portforward and A-record settings by sending UDP packets from my laptop on another network using "nc -u dev.mydomain.com 9999" and typing some teststrings, so this all works.
On the 4G chip I use the following AT-commands:
// Check network
AT+CSQ
+CSQ: 21,0
AT+CGREG?
+CGREG: 0,5
AT+COPS?
+COPS: 0,2,"20416",9
AT+CGCONTRDP
+CGCONTRDP: 1,5,"iot.t-mobile.nl","x.x.x.x.255.255.255.0" <-- crossed out my ip
// Create UDP socket
AT+CSOC=1,2,1
+CSOC: 0
// Connect socket 0 to the listening port on the Raspberry Pi
AT+CSOCON=0,9999,"dev.mydomain.com"
OK
// Send "test"
AT+CSOSEND=0,0,"test"
At this point I expect to see "test" appear in the command line on the Raspberry Pi, but nothing happens. In the T-mobile portal it shows a PDP-context is successfully activated.
Also, setting the APN manually with AT*MCGDEFCONT="IP","iot.t-mobile.nl","username","password" doesn't work.
Did you work this out Hans? I was plodding along with a SIM7020E following https://www.waveshare.com/wiki/Pico-SIM7020E-NB-IoT code examples. Was successfully sending HTTP GETS to a server (without having to use micropython's wretched urequests lib) via the CHTTPCREATE/CHTTPCON/CHTTPSEND AT cmds, that seem to be be able to send packets over LTE to a server without specifying TCP/UDP etc or using a socket. Maybe give it a try?
Sadly I got the bright idea of trying an 'AT+POWD=1' cmd over the uart (was supposed to power the 7020E down) & now the module now does nothing but echo AT cmds (still auto connects to the LTE network & slow flashes the network led, just won't do anything else.) Real shame, nice little module otherwise.
I wanna catch probe requests of mobile devices that are not connected to a network using monitor mode on Raspberry pi 3. I am using Raspbian OS. I used "Wifite" command but it only shows the mac addresses of access points and not of the non connected mobile device. I am a beginner in networking and Raspberry pi. Kindly guide me which commands should I use for this purpose?
You might try looking into sniff-probes.
It switches WiFi channels every two seconds and captures incoming packets using tcpdump.
I'm playing arround with a Raspberry pi zero but it has some issues powering my WIFI dongle.
Nov 21 21:42:49 raspberrypi kernel: [ 456.466068] usb 1-1.1: rejected 1 configuration due to insufficient available bus power
It works, but it requires some manual labour to to turn it on:
echo 1 > /sys/bus/usb/devices/1-1.1/bConfigurationValue
In my case, this enables the device and then all is well. However, I need to repeat this step after each boot (tried init script, no luck yet).
My question is how to solve this problem. Preferably i'd just like to disable the power check (if possible) and just have the kernel configure the device.
Is this possibe/is there a better solution?
I had a similar problem (my router sometimes acted weird and my Pi didn't reconnect) and I use a script that checks every minute if the Pi has a wifi connection, if not it "reboots the wifi". (Got it from this tutorial http://alexba.in/blog/2015/01/14/automatically-reconnecting-wifi-on-a-raspberrypi/)
#!/bin/bash
# The IP for the server you wish to ping (8.8.8.8 is a public Google DNS server)
SERVER=8.8.8.8
# Only send two pings, sending output to /dev/null
ping -c2 ${SERVER} > /dev/null
# If the return code from ping ($?) is not 0 (meaning there was an error)
if [ $? != 0 ]
then
# Restart the wireless interface
ifdown --force wlan0
ifup wlan0
fi
Although it probably is not the most elegant solution you could just follow this tutorial and replace
ifdown --force wlan0
ifup wlan0
with this I guess:
echo 1 > /sys/bus/usb/devices/1-1.1/bConfigurationValue
But since you say that you say that you just need to run this script on boot and it works until you power the Pi back off again making a simple python script like
import os
os.system("echo 1 > /sys/bus/usb/devices/1-1.1/bConfigurationValue")
and making sure it starts on boot by adding this line in the /etc/rc.local file just above the exit 0 in that file:
sudo python /path/to/the/python/script/this_script.py
This should do the trick although I'm pretty sure the Pi has a good reason disabling your Wifi dongle (I'm pretty sure you could 'burn out' your Pi by using to much current if there was no protection). What Wifi dongle are you using and what are your powering you Pi with? I'm sorry for my not so clear answer, I'm just starting to get into the Pi but I hope I was at least of some help.
I have a Raspberry PI with Win 10 IoT installed.
The device is connected through Ethernet, I can ping it
I've connected through Powershell, changed admin password. Followed instructions here: http://ms-iot.github.io/content/en-US/win10/samples/PowerShell.htm
I can connect to the device's web based interface http://ip:8080
However, WindowsIoTCoreWatcher.exe does not show or list my device. I tried Refresh button, run as admin. Still no result.
How can I fix the issue?
Thank you,
WindowsIoTCoreWatcher listens for UDP broadcasts that are sent every five seconds by a process running on the device: C:\Windows\System32\ebootpinger.exe. It appears that this process occasionally dies or stops broadcasting, particularly if the device has not been rebooted in several days. It can be restarted with the PowerShell command (e.g. in a remote interactive session):
Start-Process ebootpinger.exe
I have an application that does a lot of binary data loading. I've encountered scenarios where an unstable 3G connection may intermittently cut out during the loading of some of this binary data, causing issues.
Is there any way, using the simulator or otherwise, to test for low-bandwidth/unstable connection scenarios?
I seem to recall Adobe Flash having bandwidth simulators in their test suite.
You can accomplish this by creating a wireless network on your Mac using Internet Sharing, degrading that interface using firewall rules, and connecting your iPhone to that network. This will actually work to debug any device that connects to a wireless network.
Using this technique, you can simulate extremely meager, lossy, or latent networks.
I use this technique instead of Apple's official Network Link Conditioner for a couple reasons:
Throttling can be applied only to specific connected devices, rather than affecting your development machine's network connection.
It can be scripted to simulate rapidly changing or "bursty" networks.
Unlike the Network Link Conditioner built into iOS, you can change the settings while your application remains in the foreground.
This uses ipfw's dummeynet feature. ipfw is technically deprecated in modern versions of OS X, but it still works fine. Unfortunately, pf (the replacement) doesn't yet support arbitrary packet delays. I'll update this answer if something changes.
Creating an awful Wi-Fi network
Plug into Ethernet if you aren't already.
Enable Internet Sharing in the Sharing pane of System Preferences. Choose to "Share your connection from: Ethernet" and check "Wi-Fi".
Get your phone connected to the network you just created and make sure you can browse the web.
Tell Mac OS's built-in firewall (ipfw) to ensure packets that have latency applied (pass through the "dummynet" in ipfw parlance) are still routed through the normal rules. This allows Internet Sharing to continue working:
phil#Nebula ~$ sudo sysctl -w net.inet.ip.fw.one_pass=0
net.inet.ip.fw.one_pass: 0 -> 0
Configure the low-quality pipe through which your iPhone's traffic will pass (14Kb/s throughput with 1% packet loss):
phil#Nebula ~$ sudo ipfw pipe 1 config bw 14KB/s
phil#Nebula ~$ sudo ipfw pipe 1 config plr 0.01
The next step varies depending on whether you're on Mountain Lion or below, or Mavericks.
For Mountain Lion (10.8) or below:
Route packets into the pipe, but only for traffic over your AirPort interface:
phil#Nebula ~$ sudo ipfw add 10 pipe 1 ip from any to any via en1
00010 pipe 1 ip from any to any via en1
Important: If you're using an Air or new MacBook Pro without a physical ethernet port, your AirPort interface will likely be called en0. Replace en1 with en0 above if that's the case.
For Mavericks (10.9):
Check the output of ifconfig and look for the bridge interface created by Internet Sharing:
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=63<RXCSUM,TXCSUM,TSO4,TSO6>
ether xx:xx:xx:xx:xx:xx
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x2
member: en4 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 6 priority 0 path cost 0
nd6 options=1<PERFORMNUD>
media: <unknown type>
status: inactive
bridge100: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=3<RXCSUM,TXCSUM>
ether xx:xx:xx:xx:xx:xx
inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x2
member: en1 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 5 priority 0 path cost 0
media: autoselect
status: active
You want the bridge interface that has an IP address; in most cases, it will be bridge100.
Route packets into the pipe, but only for traffic over the bridge interface:
phil#Nebula ~$ sudo ipfw add 10 pipe 1 ip from any to any via bridge100
00010 pipe 1 ip from any to any via bridge100
Change bridge100 if it has a different name on your system.
Simulating a changing network
You can change the values 14KB/s and 0.01 in step 5 above to simulate different types of networks. You can also specify config delay 1000 to introduce a 1000ms delay. See the manpage for more options.
You can continue to reconfigure the pipe after adding the rule for it. For instance, to simulate nearing the edge of cellular coverage, issue this command while your app is running and connected (95% packet loss):
phil#Nebula ~$ sudo ipfw pipe 1 config plr 0.95
There is no need to run sudo ipfw add 10 … again after reconfiguring the pipe. You can script these changes to simulate an extremely dynamic network environment.
Cleaning up
You can issue sudo ipfw delete 10 to put everything back to normal, or just reboot.
Here is a great script I've used on OS X to throttle connection speed, or just turn it off, for any domain you want. I wish I could remember where I got it from to give credit.
Save the code to a file on your machine and name it "throttling". Then to run, just enter the below in terminal, and select from one of these speeds: [full|fast|medium|slow|wwdc|off].
"./throttling medium"
If you have the script set up to throttle localhost:3000 and stackoverflow.com, then loading up a page from either of those domains in your browser (or iphone simulator or whatever) will respond slower and load files slower. It's been really great for testing iphone connectivity bugs.
http://gist.github.com/499177
You could test a number of things if you turn 3G off and connect to wifi.
Log into your router and rate limit the mac address of your iphone. (to test slow connections)
Kill the power to the wifi when in the middle of downloading data
Reboot the wifi router when downloading so the phone has connection, loses it, and gets it again. ( to test different scenarios )
Happy Coding!
I read of someone testing with their iPhone connected by USB cable and the phone wrapped in aluminum foil to get the cellular signal reduced. You can turn off WiFi and 3G and just have Edge and then attenuate it with foil. Sounds crude but...
You could also use an iPhone 4 and hold in your hand to short the two antennas together ;-)
Chrome 38 includes network emulation in the device emulation settings. You can select from Offline, GPRS, EDGE, 3G, DSL and WiFi. Also emulates increased latency.
It's not as accurate as testing on a real device but it's much quicker to set up.
Well, low bandwidth is simple: turn off Wifi, turn off 3G. Cutting connection is also simple: turn on wifi, get connected, power off your wifi access point.
I guess you could connect to a Mac (if you had one) setup as a WiFi base station (ad-hoc network). Then on the Mac set up a "dummynet" bandwidth limit and/or high packet loss filter.
That's what I do to simulate the slower higher-latency DSL lines I am making software to setup for Macs.
On the iPhone you can't. One way would be to share your computer WIFI connection to your iPhone but to slow it down using a special application.
This blog post describes some approaches for that:
http://blog.aptivate.org/2010/01/23/make-sure-your-apps-work-in-the-field/