Getting MAC Address

Python 2.5 includes an uuid implementation which (in at least one version) needs the mac address. You can import the mac finding function into your own code easily: from uuid import getnode as get_mac mac = get_mac() The return value is the mac address as 48 bit integer.

How to access Network panel on google chrome developer tools with selenium?

This possible via Selenium WebDriver. For this you should do the following: Download selenium language-specific client drivers from – http://docs.seleniumhq.org/download/ and add apropriate jar files to your project build path. To run a test with Chrome/Chromium you will also need chromdriver binary which you can download from – http://chromedriver.storage.googleapis.com/index.html Create a test case like this: … Read more

Network listener Android

New java class: public class ConnectionChangeReceiver extends BroadcastReceiver { @Override public void onReceive( Context context, Intent intent ) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService( Context.CONNECTIVITY_SERVICE ); NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo(); NetworkInfo mobNetInfo = connectivityManager.getNetworkInfo( ConnectivityManager.TYPE_MOBILE ); if ( activeNetInfo != null ) { Toast.makeText( context, “Active Network Type : ” + activeNetInfo.getTypeName(), Toast.LENGTH_SHORT ).show(); } … Read more

close vs shutdown socket?

This is explained in Beej’s networking guide. shutdown is a flexible way to block communication in one or both directions. When the second parameter is SHUT_RDWR, it will block both sending and receiving (like close). However, close is the way to actually destroy a socket. With shutdown, you will still be able to receive pending … Read more

How can I see if there’s an available and active network connection in Python?

Perhaps you could use something like this: import urllib2 def internet_on(): try: urllib2.urlopen(‘http://216.58.192.142’, timeout=1) return True except urllib2.URLError as err: return False Currently, 216.58.192.142 is one of the IP addresses for google.com. Change http://216.58.192.142 to whatever site can be expected to respond quickly. This fixed IP will not map to google.com forever. So this code … Read more

Best C/C++ Network Library

Aggregated List of Libraries Boost.Asio is really good. Asio is also available as a stand-alone library. ACE is also good, a bit more mature and has a couple of books to support it. C++ Network Library POCO Qt Raknet ZeroMQ (C++) nanomsg (C Library) nng (C Library) Berkeley Sockets libevent Apache APR yield Winsock2(Windows only) … Read more

Get local IP address

To get local Ip Address: public static string GetLocalIPAddress() { var host = Dns.GetHostEntry(Dns.GetHostName()); foreach (var ip in host.AddressList) { if (ip.AddressFamily == AddressFamily.InterNetwork) { return ip.ToString(); } } throw new Exception(“No network adapters with an IPv4 address in the system!”); } To check if you’re connected or not: System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();