Wednesday, July 15, 2009

Sending customized TCP packets using jpcap and libpcap

Sorry I haven't blogged for a while; I've moved to Twitter.com/sumanrs for most updates. I'm only using this blog for longer posts now.

So my task this week was to create customized TCP packets for the NetSerV experiment. I would have had to look for a user-level TCP stack ... or use the popular pcap implementation, which can generate packets on the network.

And since this has to run on Java, we have to use jpcap (there is an older version on Sourceforge, which I did not try.)

I was able to successfully create a program that can send TCP packets, both on Windows and Linux. And was able to compile and run SendTCP.java, which can send packets

To get the TCP packets to send properly in a local network and be received at the remote node, you need to know a few things:
  1. Make sure to correctly specify source and destination MAC addresses. You can get the source MAC address by doing:
    ether.src_mac = device.mac_address;
    You will have to manually set the receiver's MAC address, or look at ARP.java to figure how to do it over the network.
  2. Make sure to correctly specify source and destination IP address. Can be done through InetAddress.getByName() as in the example.
  3. For unknown TCP ports that don't have any daemons running on them, you may not get a ACK response for a SYN packet, though you will get a TCP RST packet.
  4. If you send it to a port that has a daemon, you will get a nice ACK packet, which you can handle properly.

Windows ran succesfully, but I learnt a few things for the Linux install since I had to run it on a AMD 64-bit processor:
  1. There seems to be no version of jpcap download on the jpcap site. So you will have to build it yourself.
  2. Download the source from the jpcap site.
  3. Follow instructions for source install here.
  4. You need libpcap and libpcap-dev installed. libpcap is most likely already installed; if you want libpcap-dev, do "sudo apt-get install libpcap-dev"
  5. You can install the native library and the JAR by following the instructions in #3.

Monday, January 26, 2009

Spring 2009: NetServ + candidacy + TA

As the Spring 2009 semester begins, I am hitting the ground running for my candidacy exam in late Feb. My topic is "Ubiquitous Communication Models for Different Network Scenarios."

While at it, I am also reading up on the following topics for the NetServ project, which I will soon start work on:
And, finally, I am TAing the COMS6125 Web Enhanced Information Management again this semester.

Wednesday, January 07, 2009

The Beginnings of Spring 2009

Back to work for Spring 2009. I am now done with courses - its a wonderful feeling to not have to be aware of when the semester starts and ends. :D Well, except I am TAing Web-Enhanced Information Management again this Spring semester... and am looking forward to it.

The downside is: I do start working on research two weeks before school starts ... but that's OK.

Right now, two items require my fullest attention:
  • Preparing my presentation for the IEEE CCNC research conference on the BonAHA framework (this weekend!)
  • Finalizing the list of papers for my candidacy exam (which will be in mid-Feb? I hope?)

Friday, November 07, 2008

Parallel computing and communication/network models - the "parallels"

Apologies for the pun, but one of my readings over the last week has been to read up on parallel computing in order to find some parallels between the opportunistic applications I have been working on (such as 7DS) and parallel computing.

Even though the two topics look different, there are actually several points in common.

Below is a list of topics, extracted from the textbook Parallel & Distributed Computing Handbook by Albert H. Zomaya, published by McGraw-Hill.
  • PRAM (Parallel RAM) model; Methods for distributing and parallelizing algorithms
  • Failures in parallel systems (Byzantine, other)
  • Dataflow models
  • Checkpointing (for recovery)
  • Distributed software systems (this is similar to RMI)
  • Data structures for parallel processing
  • Shared memory, memory consistency
More details to come soon.

Wednesday, October 22, 2008

Finished BibTex on IRT publications page

Today I fixed up the BibTeX links on the IRT publications page. I also changed the links so they open in a new, smaller window (like a dialog.)

Wednesday, October 15, 2008

Papers related to communication/networking middleware: IEEE Network

Am on the trail of papers related to work on communications or networking middleware from a high-level perspective. Been reading IEEE Network publication online all day, and found some interesting issues as well as articles that may be quite relevant:
  • (2008) Vol 22, Issue 4: Context aware networks, in mobile scenarios (whole issue)
  • (2007) Vol 21, Issue 4: GE Network Systems Architecture (whole issue)
  • (2006) Vol 20, Issue 4: VON: a scalable peer-to-peer network for virtual environments (this paper has analysis of other P2P-based NVE systems)
  • (2006) Vol 20, Issue 3: A survey of transport protocols for wireless sensor networks
  • (2004) Vol 18, Issue 1: GE Middleware technologies for future communication networks (whole issue, and is very good)
Among other things:
  • Registered and uploading final version of paper for CCNC 2009 conference.
  • Testing the new WORKIT box, which may be the final version of the box we will ship

Tuesday, October 07, 2008

Grid computing and P2P resource discovery

Excellent survey paper on various programming models in grid computing, which relates very closely to what I am looking into in finding programming models for the get/set and distributed network computing environment at large: "Grid Programming Models: Current Tools, Issues and Directions".

Another related work paper is "Peer-to-Peer Resource Discovery in Mobile Grids," which defines a P2P service discovery protocol/framework for mobile environments.

One other direction I am currently looking into is the relationship between grid computing, cloud computing and the mobile distributed computing I am working on...

Monday, October 06, 2008

Network programming: scalable web servers and Java NIO

While looking for network programming APIs for my candidacy, I came across two excellent papers/presentations which are not directly related to my topic, but I need to bookmark in any case...

The first one is Scalable Network Programming: Or: The Quest For A Good Web Server (That Survives Slashdot) by Felix von Leitner. It talks about the problems of building scalable web servers, from ground up, including looking at fork() code, the time involved, measurements, comparison with threads, etc. An excellent read for people who know scaling web applications is hard, but would like to know more of why from an "under the hood" approach.

The second one, Improving Java Network Programming, by Brian Runk, is a simple application-level presentation, but compares the java.net and java.nio packages and discusses practical issues that arise while programming large-scale enterprise systems like ones built at Morgan Stanley.

Wednesday, October 01, 2008

Sockets over HTTP: Comet and Orbited

After my talk on "Disruption Tolerant Applications in Opportunistic Networks" at the IRT meeting yesterday, I found some interesting info about sockets over HTTP using Javascript.

The Javascript implementation, called Orbited, claims to provide a TCP socket over a web browser. Sounds like a really interesting concept. A slightly outdated tutorial on writing an IRC client using Orbited.

This is related to a neologism called Comet, which is "a web application model in which a long-held HTTP request allows a web server to push data to a browser, without the browser explicitly requesting it." (quote from Wikipedia's entry on Comet.)

Friday, September 26, 2008

Related work: Market Contact Protocol

An interesting Master's thesis called "Content Sharing for Mobile Devices" has an extremely comprehensive and complete look at the problem of finding and sharing content with other local mobile devices.

The thesis has excellent documentation comparing DHTs, overlay networks and other related work in this field.

The simulation and datasets in the thesis are also very comprehensive, and may be helpful if we ever do a simulation ourselves in this field.

The implementation itself, a protocol called "Market Contact Protocol" - at first glance - seems very similar to what we are doing with the BonAHA project, and related work such as LightPeers.

Thursday, September 25, 2008

Nokia n800, Python, Bonjour and mDNS

A project student has the task of developing useful 7DS-like applications on our lab's Nokia n800, so we went searching for how to develop applications on this platform.

It appears that Python is the Nokia n800's programming language of choice - tough luck for Java. So we would have to start working with Python and developing our framework in that language.

In order to use Bonjour on Python for the Nokia, we need the pyBonjour library.

We also need to install the Bonjour mDNSd daemon for handling mDNS packets - or Avahi, which is more supported on Linux. A look around reveals that Avahi is available on the Nokia n800 through the Canola project.

But for pyBonjour to work with Avahi, the binary-compatibility layer with Bonjour need to be installed [libdnssd1 and libdnssd-dev].

There are existing demo applications (one and two) on Nokia using Bonjour. Both seem to relate to web servers.

Some more info about Python and mDNS from razorvine.

Thursday, September 18, 2008

Data-object vs communication P2P applications

It appears that there are two sets of applications that BonAHA (or any ad-hoc network framework) will have to cover and address:
  • Data-object and file-oriented: In this sort of application, the most important topic are the files and the data themselves, not necessarily the location of these. E.g.: file sharing, file synchronization, chat
  • Person-to-person communication: In this sort of app, the focus is on the person to communicate with (not even the node itself, which is an abstraction, but the person). For example: drag-and-drop file sharing, instant message
So, BonAHA will have to address which of these two models it will be targetting - and if it can, and will, target both classes of applications.

DHTs actually handle the data-object model very well, expect that their setting up of an overlay network and additional network traffic in networks with heavy churn leaves much to be desired for MANET applications.

mDNS and DHT-related work

This was a very productive week in looking forward to working more on the BonAHA framework and our architecture for disconnected ad-hoc networks.
  • mDNS and DNS-SD: Reading the specifications again, particularly focusing on their handling of:
    • Packet size: How does it deal with large packets? What is the maximum packet size?
    • iChat TXT record data: iChat exchanges its avatars using DNS-SD. But how large is it? What are the tradeoffs?
In terms of related work, here are some items I looked at this week that seem related to 7DS and the BonAHA framework:

Tuesday, September 02, 2008

Updated website + Fall courses

As Fall semester rolls around, I decided to start it off by updating my website to use a new template - Concrete on FreeCSSTemplates.org. (PS: FreeCSSTemplates.org has some great, simple and totally free CSS templates for your website.)

I will end up taking "Analysis of Algorithms, I" this semester and may end up auditing the "Artificial Intelligence" course if possible...

Friday, August 22, 2008

WORKIT website now detects duplicate usernames; gives error messages

The WORKIT website now gives error messages properly for two common reasons:
  1. Duplicate username
  2. Empty fields
I have put up the code here since Blogger's code highlighting system isn't too good.

Tuesday, August 19, 2008

Change to a new DB server

  1. Tis the day the WORKIT website moved to a new DB server, the shared MySQL server ... so we don't intrude on department MySQL server space. Requires a bit of recoding on my part to get the WORKIT website working with the new server.
  2. Also, found that users can create duplicate entries with same username - that's a no-no. Need to fix this.
  3. The Physics Machine Shop and I played phone tag today - we finally decided to meet on Thursday to finalize the hardware setup for the remaining baseline kits.

Friday, August 15, 2008

vi / vim extra tabs during paste - solved

I've had this annoying problem with vi / vim ever since I started to use it - whenever you copy text and paste it into vi or vim, it indents each additional line with an extra tab, rendering it completely unreadable and requiring manual editing.

Luckily, I was able to find help on Google groups and the Wikia Vim pages. Solving this problem is as easy as typing in the command:
:set paste


That worked for me!

Wireless cards, antennas and connectors

Today I hunted down a wireless antenna-cable combo to go with our wireless card, the Atheros-based Gigabyte GN-WIAG02.

I didn't realize that there were different forms of cables and antenna for wireless cards, so I had to learn more about these.

I found out on Hyper Link Tech that there are several types of these. Because the Gigabyte card is a 802.11 b/g, which runs on the 2.4GHz frequency, what I needed was a 2.4 GHz rubber duck antenna. 5 dBi seems to be fine for the WORKIT testbed.

There were some helpful pages on gumph.org and Seattle Wireless that helped me find out more about the antenna, cables and connectors that are needed for wireless.

It appears that the most common connector for the miniPCI based wireless cards is the MMCX connector.

Finally decided to get the AOpen wireless antenna, which appears to have the antenna as well as the cables needed to fit the antenna onto the kit.

Friday, August 08, 2008

Rich UIs in Java: themes and fade animations

I was looking for ways to improve the look and feel of Java applications - for presenting my Java-based research work as a nice-looking app and for demos. I was inspired by some of the Adobe AIR themes out there, and I found some interesting stuff.

Among the many Swing Pluggable Look-and-Feel solutions is one that really stands out - Substance. It looks absolutely phenomenal, with a variety of options and customizations, plus its open-source. It easily stands out as a must-use PLAF for Swing. Take a look at some Substance screenshots.

There's that for themes ... but how about fade effects and transitions?

A little bit more searching reveals the animation layer, which includes transitions - in fact, automated transitions with no changes to app code! You need to see the above link for yourself to believe it.

Apparently, this fade animations is part of the laf-widget project now.

Thursday, August 07, 2008

insmod, kernel versions, modules and Linux distros

The joy of working with kernel versions and kernel modules.

So after spending a long time finally getting a modpost program running so I could build kernel modules, I was finally able to get them to compile. However, I found that the modules were not loading - insmod and modprobe gave a very unhelpful "-1 Invalid module format" error.

A little bit of searching around for "kernel modules" lead me to the helpful Linux Loadable Kernel Module HOWTO. A page titled Technical details provides the full details about how to find information about the module.

I was able to confirm that the module had compiled properly, and that it was atleast displaying the right meta-information. So what had gone wrong?

A search for the actual error message "invalid module format" led me to a forum discussion on Linuxquestions.org about insmod, where one poster suggesting using 'dmesg' to find out the details of the error.

Excellent information. A line in dmesg shows:
No module found in object
kaodv: version magic '2.6.20.1 preempt mod_unload 486'
should be '2.6.20-486-voyage preempt mod_unload 486'


Perhaps because I used the Debian Voyage kernel instead of the Voyage kernel sources? :( And after all the trouble I went through in finding a corresponding kernel source and building the tree and the toolkit...

Maybe there's a way to just rename just the kernel name, since everything else seems to match ... stay tuned.