3 Nov 2021

Tenda Nova MW12 MW6 cannot connect to wireless printer on mesh network from wired computer

I have a home network on a TP-Link Archer C7 router, which I was using for WiFi, but also have some computers wired directly on ethernet connections. It's been a fairly reliable router, but the WiFi has never been great. 

I finally replaced the WiFi part of it using a 3-node Tenda Nova MW12 mesh system. To do this, I plugged the primary Tenda node into one of the ports on the router. Then I placed the other Tenda nodes around the house, turned off the old router's wireless function, and we were off! Well, after changing the SSID of the Tenda mesh to be the same as the old router's SSID, with same password, so I wouldn't have to update the wireless connection details on all the devices around the house...

Anyway, all was fine until I wanted to print to my wireless HP M252DW printer, from one of the computers that were still wired to the old router. My windows machine could no longer see the wireless printer on the network. Turns out, the Tenda mesh is on a different IP subnet to the old router. By default the mesh devices were on the 192.168.5.x subnet, whereas the old router subnet was 192.168.0.x. 

After a lot of faffing about, it turns out that Tenda have anticipated my use case, and I just hadn't configured the mesh properly. By default, the Tenda system is set to DHCP mode under Internet Settings > Connection Type. All I had to do was change it to Bridge mode. Then the mesh started using 192.168.0.x IP addresses assigned by the old router instead, and I was now able to print to the mesh-bound wireless printer, from the old wired network.

If anybody is interested in my thoughts of the Tenda Nova MW12 mesh, it's early days but the WiFi is markedly faster than via the old Archer C7, and the coverage around the house is now superb. Haven't had any dropouts yet. The MW12 also has a PPPoE mode, and port forwarding, so really I should be able to bin my old router completely. I will be doing this as soon as I get a cheap ethernet hub, as I need more ports than the Tenda node provides.

17 Mar 2021

Download SFTP file and send to Azure Blob Storage with minimal memory usage

 

In Azure we use the Renci SSH.NET library to download a file from an SFTP server and put it into Blob Storage.

Our first approach was simple: Downloading the file in entirety to memory, and then uploading to blob store.

using (var memStream = new MemoryStream())
{
    sftpClient.DownloadFile("sftpFilePath", memStream);
    memStream.Position = 0;
    var container = cloudBlobClient.GetContainerReference("blobContainerName");
    var blob = container.GetBlockBlobReference("blobName");
    await blob.UploadFromStreamAsync(memStream);
}
However, we soon realized this approach meant we consumed as much memory as the file's size. We fixed this by instead opening a writeable stream to the blob, and connecting that directly to the sftp client's DownloadFile method: 
var container = cloudBlobClient.GetContainerReference("blobContainerName");
var blob = container.GetBlockBlobReference("blobName");
using (var blobStream = blob.OpenWrite())
{
    sftpClient.DownloadFile("sftpFilePath", blobStream);
}

Note however that with this approach you may run into the limit of 100,000 uncommitted blocks that azure blob storage enforces. We have to select the block size, which is the size of each "chunk" of blob that the SDK uploads. You do this by setting the blob's StreamWriteSizeInBytes property, which can be between 16Kb and 100Mb. So for 4Mb blocks, do: 

blob.StreamWriteSizeInBytes = 4 * 1024 * 1024;


However, in version 11.1.0.0 of the azure storage library, we noticed that this setting seemed to be ignored when using OpenWrite, and the actual block size was something like 5Kb! This meant we hit the uncommitted block error for files over 450Mb in size. So, to handle very large file uploads we had to instead revert to using UploadFromStreamAsync (which does honour the StreamWriteSizeInBytes property), and had to do some extra work to surface the reading stream to pass to it.

1 Feb 2021

Find and kill a Windows 10 process on a given port

 

FIND the naughty process PID:

netstat -a -n -o | findstr *PORT_#_HERE*


KILL the naughty process:

taskkill /f /pid *PID_#_HERE*


If I helped you out today, you can buy me a beer below. Cheers!