tech.zpoley.net

quick little hacks 
Filed under

udps

 

Python subprocess

I thought this was cool because it made writing a quick test for my simple UDP server really clean and easy. What I needed to do was spawn another process to run alongside my script. In this case it was this subprocess that I wanted to test. Python subprocess made this really easy.

The script starts the udps server in a child process using subprocess.Popen and then sends a UDP datagram to the udps server, which gets written to the server log file. The test verification is the printed content of the udps.log file created by the udps server subprocess, and then subprocess.Popen.kill is a nice simple way to end the udps process.

Filed under  //   Python   UDP   subprocess   udps  

Comments [0]

Simple C UDP logging server

I've been using and liking this simple UDP server setup to receive and log stats data from iPhone apps. I'm running this simple UDP server (udps), and using the following code to send UDP datagrams from iPhone apps:

The benefits of this setup are no waiting client side, and low overhead server side (just write to a log file to process later). UDP is unreliable so I could be missing a few datagrams, but I'm just sending stats that are nice to have but not necessary. I process the entire log every once in a while, and stream it back over http to analyze the incoming results in real-time.

Filed under  //   AsyncSocket   C   Logging   Objective C   Server   UDP   udps  

Comments [0]