Communicate through a VPN link using Arduino UART WiFi Module - networking

The following describes the configuration of the system and other details. The problem is mentioned after that. If the initial description is too much or not needed, please skip it.
I have a VPN (between two SIMs). One SIM is in a USB dongle, the other one is in a WiFi router. The dongle is connected to computer 'A', and another computer ('B') is wirelessly connected to the WiFi router which can access the dongle. The VPN is between the router and the computer 'A' (dongle). As the WiFi router leases 'B' a private IP, 'A' can't ping 'B'. But 'B' can ping 'A'. There is no issue up to now.
I have created a socket-based simple Java network application (client - server pair). The client is running on 'B', the server is running on 'A. Only the client can send data to the server, the other way around is not possible. This part also is OK. Now I need to replace the computer 'B' with an Arduino. I need to send some data from the Arduino to computer 'A' through the same network.
For this, the Arduino needs a WiFi module to access the router. I've this USART WiFi module with the shield. It can successfully connect to the router, (I can ping it from a computer, which is also connected to the router).
THE PROBLEM
Now the configuration is as below.
There's the (server) application running on computer 'A', which is listening on a given port (port 8090). How can I send some data (eg. some text "hello!"), from the Arduino to the computer 'A'?
Please note that for the WiFi module I'm using, I found some examples for applications based on the Arduino WiFi shield. But I can't apply them to my configuration (can I?).

Related

Transfer data between two devices on different routers on the same modem

I have two devices, a PC and a RaspberryPi, that are connected to two different routers (one has VPN, one does not), that are connected to the same modem. (See diagram). The two routers are physically separated, so it would be difficult to connect them with a cable.
I am trying to access the RaspberryPi from my PC using SSH to run programs remotely on the Pi, and have the Pi send data that the program scrapes back to my PC for processing.
My question is, is this possible? And if so, how would I be able to implement it?
Thanks
I had this working (prior to my network reconfigure).
What I did was set router A as DHCP server.
Router B was configured as not to hand out IP Addresses.
Connect router A and router B on the LAN side.
All clients went through Router A, unless the devices' IP Settings were changed. I only changed gateway to router B to have the secondary connection.

zeroconf on wireless connection without password

I want to setup a register / discover type of service connection between 2 devices on the same wireless LAN. Idea is to find, connect and send wireless router password to a new device for easy installation. This needs communication between 2 devices on the same wireless network before connecting to router with SSID, password.
I'm aware of zeroconf, bonjour and mDNS libraries. All implementations I see start with connecting to wifi in station mode to get a local IP with hardcoded SSID and password, which is not known at this stage.
In other words, how can connect to wireless and get a link local IP without SSID and password?
-- Edit for better explanation --
The flow i'm looking for is like this:
1- Mobile phone (iphone or android) is connected to secure home wireless network as usual
2- A new device with wireless interface is powered on first time.
3- Device gets (or sets) a local IP and local dns name (multicast ip and name) for itself
4- Device broadcasts its available services to the network
5- Phone discovers the service, along with devices' local name and even local ip already assigned.
6- Phone initiates a direct connection with the device to send wireless configuration information (ssid and password for the access point)
7 - Device saves this information, resets into normal operation mode
8 - Device connects to internet
9 - Device services are still available in the local network
-- edit --
Code will run on esp32 or esp8266, so compatible c or arduino libraries are ok.
I'm aware of smartconfig implementation of ESPTouch application, but it is a horrible design! Discovery program tries to create sockets to every possible IP address to find the peer IP.
Read this sentence in your question again and think about it:
In other words, how can connect to wireless and get a link local IP
without SSID and password?
The protocols you mentioned are only possible AFTER you're part of the network. As you know, wifi networks are protected to prevent unauthorized access.
Try wifi protected setup (WPS) in Google.

Can machines communicate via serial port without having network adapters?

In VMWare, I have two virtual machines which are connected to each other through a named pipe. Can they communicate with that serial port or do I need to enable the network adapters ?
Configure VMWare to connect the serial port of one VM with the serial port of another. This is the virtual equivalent of plugging a null modem cable into the serial ports of two physical computers. Then, setup a null modem connection, where you network over PPP (Point-to-Point Protocol) just like the old analog modem days.
That said, why do you want to do this? Serial connections are very slow and are commonly used when a very simple, dumb, low level connection is needed. If you want to isolate traffic between two computers, create new virtual NICs on each and add them to the same, separate virtual subnet. This will be much faster, means you do not need to connect and disconnect over PPP and the existing VMWare management and monitoring tools work with it.

Wake On LAN Configuration

I am trying to configure my laptop to be able to Wake On LAN via Magic Packets. I have a magic packet sniffer and it alerts me when a magic packet has been recieved(runs on target machine). The trouble is when I try to use the external ip address instead of the internal address. I have port forwarded port 9 to my internal ip(10.0.0.x, NOTE: x is only one digit). If I use the internal ip address, it tells me that a magic packet has been received. If I try the external ip address and sending from the target machine(to itself) it receives the magic packet. If I send it through a different machine or a website, it does not work. I am connected via ethernet cable(CAT 5). I also have the "Wake on LAN" setting in my BIOS set to "ENABLED". Also, my computer is set to "Allow this device to wake the computer". Am I doing something wrong?
P.S.
The solution to the previous problem was to start the Simple TCP/IP Service in Windows.
To use Wake on LAN across the internet (=> wake on WAN), you must do one of these things :
Edit your router's ARP table so it can forward the magic pack to the target computer with its MAC address
Port forward to LAN broadcast address so the target computer will always receive any magic packet sent to your router until it is plugged to the router
Buy a router with a built-in wake on lan feature (like DD-WRT open source firmware)
Use a magic packet repeater to forward magic packets to the broadcast address. This one should be always powered on
I'm using the fourth option to wake my home computer from my work. I bought an Arduino Uno + Ethernet shield and wrote a little program to do the job (forward magic packet). I set a port forward rule into my router (Netgear DG834G) to forward UDP 9 to the Arduino IP address.
I wrote a tutorial about this on my personal website, it's in French but code is universal ^^ : http://www.finalclap.com/tuto/arduino-wake-on-lan-repeater-80/
I did some more research and it turns out that unless the router itself has a built in management and can be accessed publicly, WoL will not work behind a router. WoL will work however if you have a device already inside the network send the magic packet to the target machine. THat completely destroys the point of WoL!

IOS4 - Send data using UDP socket on Wifi

I am trying to send data using the AsyncUDPSocket class. And I can send data using the iPhone simulator over the wire to another machine that is running a simple C-coded listening server. I can also receive data over the wire using a client connected to the simulator(server). However, when I tried the same over Wifi, using the simulator, I could only send data but not receive any data.
I read on another post, that unicast data makes this possible. How can I acheive this using AsyncUDPSocket?
Thanks,
Angelo.
Ok, I figured this out. A newbie kind of thing, really.
When I set my Mac network preferences to Ethernet, I get an IP for me to communicate. However, when I turn Airport(Wi-Fi for more newbies) ON, and ethernet cable disconnected, I checked my network preferences, and sure enough my IP address was a different one.
Spoke to a friend (an ace in networking) and the thing clicked immediately: On WiFi networks a DHCP server allocates an IP address. This IP address has to be reserved, at the very least, at the DHCP server. Since my IP was not reserved, I had to change the IP address, in my udp_client.c file, recompile and run the client to connect.
BTW, I can now communicate between my iPhone and my PC using my local WiFi (office) network.
For any who might face the same problem, do not be assured that the IP address of your mchine is the same, when you switch from LAN to Wifi, and use the device mostly for WiFi reated testing. :)

Resources