How to monitor network calls made from iOS Simulator

Personally, I use Charles for that kind of stuff. When enabled, it will monitor every network request, displaying extended request details, including support for SSL and various request/reponse format, like JSON, etc… You can also configure it to sniff only requests to specific servers, not the whole traffic. It’s commercial software, but there is a … Read more

How to get access to webpack-dev-server from devices in local network?

(If you’re on a Mac and network like mine.) Run webpack-dev-server with –host 0.0.0.0 — this lets the server listen for requests from the network, not just localhost. Find your computer’s address on the network. In terminal, type ifconfig and look for the en1 section or the one with something like inet 192.168.1.111 In your … Read more

How to write a scalable TCP/IP based server

I’ve written something similar to this in the past. From my research years ago showed that writing your own socket implementation was the best bet, using the asynchronous sockets. This meant that clients not really doing anything actually required relatively few resources. Anything that does occur is handled by the .NET thread pool. I wrote … Read more

Why is it not advisable to have the database and web server on the same machine?

Security. Your web server lives in a DMZ, accessible to the public internet and taking untrusted input from anonymous users. If your web server gets compromised, and you’ve followed least privilege rules in connecting to your DB, the maximum exposure is what your app can do through the database API. If you have a business … Read more

How can I use iptables on centos 7? [closed]

With RHEL 7 / CentOS 7, firewalld was introduced to manage iptables. IMHO, firewalld is more suited for workstations than for server environments. It is possible to go back to a more classic iptables setup. First, stop and mask the firewalld service: systemctl stop firewalld systemctl mask firewalld Then, install the iptables-services package: yum install … Read more

Android emulator: How to monitor network traffic?

There are two ways to capture network traffic directly from an Android emulator: Copy and run an ARM-compatible tcpdump binary on the emulator, writing output to the SD card, perhaps (e.g. tcpdump -s0 -w /sdcard/emulator.cap). Run emulator -tcpdump emulator.cap -avd my_avd to write all the emulator’s traffic to a local file on your PC In … Read more

How to detect the physical connected state of a network cable/connector?

You want to look at the nodes in /sys/class/net/ I experimented with mine: Wire Plugged in: eth0/carrier:1 eth0/operstate:unknown Wire Removed: eth0/carrier:0 eth0/operstate:down Wire Plugged in Again: eth0/carrier:1 eth0/operstate:up Side Trick: harvesting all properties at once the easy way: grep “” eth0/* This forms a nice list of key:value pairs.

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)