Monthly Archives: February 2012

Simple UDP Client

<pre> /* UDP client in the internet domain */#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <netdb.h>#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <string.h> #define MIN(x, y)  ((x) < (y) ? (x) : (y))#define MAX(x, y)  ((x) > (y) ? (x) : (y)) void error(const char … Continue reading

Posted in Uncategorized | Leave a comment

Simple UDP Server

#include <stdio.h>#include <stdlib.h>#include <string.h>#include <netdb.h>#include <unistd.h>#include <errno.h>#include <sys/socket.h>#include <sys/types.h>#include <arpa/inet.h>extern int h_errno;void error(const char *msg);int UdpSocket(int protocol){ int sockfd;    sockfd = socket(AF_INET, SOCK_DGRAM, 0); if (-1 == sockfd) { error(__func__); } return sockfd;}void error(const char *msg){ printf(“Error Code: %d”, … Continue reading

Posted in Uncategorized | Leave a comment

Intro to Ruby

Just got my hands dirty with Ruby today. It’s an interesting language, yet simple to learn. Unlike some other dynamic programming languages that too cryptic to learn, Ruby is easy to learn, similar to Tcl. Here’s an example of a … Continue reading

Posted in Uncategorized | Leave a comment