networking

Alternative to HttpClient for Windows Phone 7.5

If you wanted to move your WinRT project to support Windows Phone 7.5, you’ll rejoice at the recent news that Microsoft’s Microsoft.bcl.Async package in Nuget that allows using Async keywords and Task class but in the end, you really used them in WinRT because HttpClient class had a GetAsync method which is not available outside WinRT.

Worry not, the Microsoft.bcl.Async package comes with a Microsoft.Threading.Tasks.Extensions assembly that if you look inside, includes:

public static System.Threading.Tasks.Task<webresponse>GetResponseAsync(this System.Net.WebRequest source)
Member of AsyncExtensions</webresponse>

Which means you can use System.Net.WebRequest in its place and it supports Task/Async.

So you can do something like:

WebRequest request = WebRequest.Create(uri);
await request.GetResponseAsync();

Can’t Ping Windows Parallels VM in Bridged Network Mode

If you can’t see your Windows 7 VM from Mac OS X in bridged mode, the problem could be the location set on your Windows 7 OS. It’s possible that with bridged mode, Windows can’t figure out the network time and default to ‘Unidentified network’ which is the same as if you chose Public and put it into a safer mode than if you chose Home or Work. Unfortunately if it were the case, you can’t really change the network type. If your VM is going to stay home and never wonder into the dangerous wildland, you can just set the ‘Unidentified network’ to be treated as a private network via:

Start -> secpol.msc
Network List Manager Policies -> Unidentified Networks
Select Private

Then you’re done!

Suppress Scapy IPv6 Warning

When you run Scapy without a default IPv6 routing gateway, Scapy will display this annoying warning:

WARNING: No route found for IPv6 destination :: (no default route?)

You definitely don’t want to see it every time you run the script you built with Scapy. To get rid of it, simply add

import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)

before importing Scapy to suppress all messages below error messages

 Scroll to top