26
2011
Beginners’ guide to socket programming with winsock
What is this about This is a quick guide/tutorial to learning socket programming in C language on Windows. “Windows” because the code snippets shown over here will work only on Windows. The windows api to socket programming is called winsock. Sockets are the fundamental “things” behind any kind of network communications done by your computer. For example when you type www.google.com in your web browser, it opens a socket and connects to google.com to fetch [...]
25
2011
Handle multiple socket connections with fd_set and select on Linux
When writing server programs using sockets , it becomes necessary to handle multiple connections at a time , since a server needs to serve multiple clients. There are many ways to do so. On linux this can be done in various ways like forking , threading , select method etc. In this tutorial we shall use the select method approach. The select function allows the program to monitor multiple sockets for a certain “activity” to [...]
24
2011
Beginners guide to socket programming in C on Linux
What is this about This is a quick guide/tutorial to learning socket programming in C language on a Linux system. “Linux” because the code snippets shown over here will work only on a Linux system and not on Windows. The windows api to socket programming is called winsock and we shall go through it in another tutorial. Sockets are the fundamental “things” behind any kind of network communications done by your computer. For example when [...]
23
2011
Gui whois client in python with wxpython
Wxpython is the python port of wxwidgets gui library. On ubuntu wxpython can be installed from synaptic. On windows it can be downloaded from the website wxpython.org And here is a small program that pops up a simple window , to take a domain name and perform a whois for that domain.
23
2011
Whois client code in C with Linux sockets
A whois client is a program that will simply fetch the whois information for a domain/ip address from the whois servers. The code over here works according to the algorithm discussed here. Code hostname_to_ip – This is a simple function to get an IP of a domain. str_replace – This is a generic string processing function that is used to search for a string in another big string and replace it with another string. Output
22
2011
str_replace for C
Php has a useful function called str_replace which can search and replace a certain string in another big string. However there is no such function in C. So I wrote up one for myself. Here is the code. Usage Output
20
2011
Easy to use C/C++ IDE for Ubuntu Linux
Here are some IDEs that work very well on Ubuntu ( and other Linuxes ) and can be used as an alternative to the terminal gcc or g++ thing. Geany Url : http://www.geany.org/ Install with sudo apt-get install geany Open any C/C++/PHP/Html/Python/Perl file and start coding. Compile with F8 , Build with F9 and execute with F5. Very simple indeed. Has many other features. No configuration needed! CodeBlocks This one is there in the Synaptic. [...]
20
2011
Get local ip in C on linux
The local ip is the source ip in IP packets send out from a system. The kernal maintains routing tables which it uses to decide the default gateway , its interface and the local ip configured for that interface. The /proc/net/route file (not really a file but appears like one) has more information about it. A typical /proc/net/route output would look like : The above lists the interface , destination , gateway etc. The interface [...]
18
2011
Code a packet sniffer in C with winpcap
Winpcap is a packet capture library for Windows used for packet sniffing and sending raw packets. Wireshark is a popular sniffer tool that uses winpcap to sniff packets. Here is a sample code which shows how winpcap can be used to sniff incoming packets on a particular interface. Code Compile The code can be compiled in Vc++ 2010 Express Edition Winpcap development files are needed for pcap.h/pcap.lib and other files. Create a project in VC++ [...]
16
2011
Get mac address from ip in winsock
Mac address or hardware address is a 48bit (6 character) wide address assigned to a network interface. It is important for the packet delivery between 2 devices like your computer and the router. Ethernet protocol uses the mac address to deliver it to the right network node. It looks like this 00-1E-58-B8-D4-69 ( the dash is not relevant). Mac address of any interface can also be changed ( called mac spoofing ) . Any network [...]
Subscribe
Recent Posts
- C code to perform IP whois
- Turbotrace – a free multithreaded and visual traceroute utility for windows and linux
- Function pread for windows
- Quick Tip: Getting the Next and Previous Items or Posts
- Compile wxwebconnect on Ubuntu 11.04 64 bit
- Disqus Comments Importer Script in PHP
- Beginners’ guide to socket programming with winsock
- Handle multiple socket connections with fd_set and select on Linux
- Beginners guide to socket programming in C on Linux
- Gui whois client in python with wxpython
An article by Binary Tides