meta data for this page
  •  

This is an old revision of the document!




CT30A5001 - Network Programming

This is just a place to store some course related material because of limitations of Noppa. This is not the main information channel for course Network Programming. Here you will find the descriptions of assignments and links to various documentations and tutorials. See course main pages for more information about course arrangements.

Instructions

Introduction exercises, slides, example codes etc.

!!READ THESE BEFORE YOU START WORKING ON ASSIGNMENTS!!

Generic instructions and requirements [updated 20.8.2012]

Generic features to implement [updated 20.8.2012]

How to send an assignment [updated 20.8.2012]

How to use Subversion version control [updated 20.8.2012]

How assignments are evaluated [updated 22.8.2012]

Attending to exercises [updated 16.8.2011]

Departmental computer resources for students

  • APPARENTLY YOU NEED TO HAVE AN “OLD” ACCOUNT (NO NUMBERS) TO ACCESS SSH.LUT.FI AS IT IS NOT MAINTAINED ANYMORE…

Example codes used on the course

Assignments

There are 6 assignments and one home exam (big assignment). The descriptions and specifications of assignments are stored only here and will be updated if needed.


Assignment1: TCP radio station, deadline 13.9.2012 @ 23:59

Assignment2: TCP multiuser chat, deadline 27.9.2012 @ 23:59

Assignment3: UDP aphorism exchange system, deadline 11.10.2012 @ 23:59

Assignment4: Multicast Game announcement system & tic-tac-toe, deadline 25.10.2012 @ 23:59

Assignment5: SCTP (TBA), deadline 1.11.2012 @ 23:59

Assignment6: RFC implementation (TBA), deadline 15.11.2012 @ 23:59

HOME EXAMINATION (TBA), deadline 3.12.2012 @ 8:59

Documents, standards, tutorials

Here are some references to material that can be found useful while working on assignments.

How to utilize university resources remotely

C coding and tools (compilers, debuggers, memory analyzers)

comp.lang.c Frequently Asked Questions

GCC, The GNU compiler collection

GNU `make`

Makefile tutorial

Makefile tutorial

GDB: The GNU Project Debugger

GDB Tutorial (short)

Debugging with GDB (long)

DDD: Data Display Debugger “GDB with GUI

DDD tutorial (long)

Valgrind

  • Some useful parameters (see more from: man valgrind)
# Gives full details of each leak
--leak-check=full

# Show also reachable and indirectly lost blocks of memory
--show-reachable=yes

# Show the origin of uninitialized values
--track-origins=yes

[[http://valgrind.org/docs/manual/QuickStart.html|Valgrind Quickstart]]

[[http://koti.mbnet.fi/~inventor/htyot/valgrind-adv.html|Short Valgrind tutorial in finnish]]
==== Text editors ====

[[http://www.vim.org/|Vim]], terminal editor. [ [[http://tips.webdesign10.com/another-vim-tutorial|tutorial]] ]

[[http://www.gnu.org/software/emacs/|Emacs]], terminal/graphical editor. [ [[http://www.gnu.org/software/emacs/tour/|tutorial]] ]

[[http://projects.gnome.org/gedit/|gedit]], graphical editor. [ [[http://library.gnome.org/users/gedit/stable/index.html.en|manual]] ]

[[http://www.nano-editor.org/|nano]], terminal editor. [ [[http://www.debianadmin.com/nano-editor-tutorials.html|tutorial]] ]

==== C and Network Programming ====

[[http://beej.us/guide/bgnet/output/html/multipage/index.html|Beej's Guide to Network Programming]]

[[http://tldp.org/HOWTO/html_single/Linux+IPv6-HOWTO/|The Linux Documentation Project: Linux IPv6 HOWTO]] ([[http://tldp.org/HOWTO/html_single/Linux+IPv6-HOWTO/#CHAPTER-PROGRAMMING|directly to programming examples]])
  * **It is highly recommended to go through the section 23!!**
  * **See 23.1.2. Lookup Functions for brief explanation of correct usage of __''getaddrinfo()''__ function**

[[http://www.ietf.org/rfc/rfc3493.txt|Basic Socket Interface Extensions for IPv6]]
  * The "official" documentation of __''getaddrinfo()''__ (**Section 6.1**) and __''getnameinfo()''__ (**Section 6.2**)
  * RFC descriptions are used as manual pages e.g. in Aptosid Linux distribution (Debian Sid) but is replaced with kernel.org version after installing manpages-dev packet.

[[http://unlser1.unl.csi.cuny.edu/faqs/sock-faq/html/unix-socket-faq.html|Programming UNIX Sockets in C – FAQ]]

[[http://sockets.blogspot.com/|Jouni's socket blog]]

[[http://www.lowtek.com/sockets/select.html|The World of Select()]]

[[http://www.eventhelix.com/RealtimeMantra/ByteAlignmentAndOrdering.htm|Byte Alignment]] - see this if you're even thinking about sending structs.

[[http://en.wikipedia.org/wiki/Data_structure_alignment|Wikipedia article of byte alignment in data structures]]

==== Multicast ====

[[http://www.tldp.org/HOWTO/Multicast-HOWTO.html|Multicast HOWTO]]

[[http://www.internet2.edu/multicast/|Multicast Working Group]]

Oracle.com Programming Interfaces Guide documentation for SOLARIS (yes, SOLARIS is UNIX and Linux is not UNIX but these pages explain multicast in informative manner):
    * [[http://docs.oracle.com/cd/E19683-01/806-4125/sockets-138/index.html|Sending IPv4 Multicast Datagrams]]
    * [[http://docs.oracle.com/cd/E19683-01/806-4125/sockets-5/index.html|Receiving IPv4 Multicast Datagrams]]
    * [[http://docs.oracle.com/cd/E19683-01/806-4125/sockets-13/index.html|Sending IPv6 Multicast Datagrams]]
    * [[http://docs.oracle.com/cd/E19683-01/806-4125/sockets-149/index.html|Receiving IPv6 Multicast Datagrams]]

==== SCTP ====

[[http://tools.ietf.org/html/rfc3286|SCTP introduction RFC]]

[[http://tools.ietf.org/html/rfc4960|SCTP specification RFC]]

[[http://www.ibm.com/developerworks/linux/library/l-sctp/|Better networking with SCTP]] by IBM/M. Tim Jones

A huge tutorial into SCTP by Cisco [ {{:courses:ct30a5000:sctp_cisco_tutorial.pdf|pdf @ wiki}} | [[http://www.sctp.org/SCTP_tutorial.ppt|original @ sctp.org]] ]

[[http://datatag.web.cern.ch/datatag/WP3/sctp/primer.htm|SCTP Primer]] 

[[http://www.isoc.org/briefings/017/|Why is SCTP needed given TCP and UDP are widely available?]] By Randall Stewart, Paul D. Amer

==== PROTOCOLS ====

[[protocols_rfcs|Different protocol descriptions & RFCs & tutorials]]

==== State machines ====

[[http://www.generation5.org/content/2003/FSM_Tutorial.asp|Finite State Machine tutorial - FSM explained through game/robotics programming]]

[[http://edu.pegax.com/doku.php?id=old_courses:csa:behaviormodel2009]] by [[http://www.pegax.com|Pekka Jäppinen]]

.. If you find good links, books, etc. please email info to assistant.

==== Packing data to character buffer ====

In previous years some people had problems with packing integers to character buffers so here is an example about how to do it. Just remember to keep track of the amount of bytes each integer reserves from the buffer used for storing data. <code c>
//PACK
*(type_of_the_value_after_htons*)&buffer_holding_data[position_to_store] = htons(value_to_store);

//UNPACK
int retrieved_value = ntohs(*(type_of_the_value_in_buffer*)&buffer_holding_data[position_from_to_retrieve]);

Bit shifting

Following example shows how to use bit shifting with binary or operations to construct a single 8 bit integer to contain packed information. Read about Bitwise operations in C.

Find out which header to include

If you have problems finding out which header has defined certain variable, use:

find /usr/include/|xargs grep -s -e "PARAMETER_TO_SEARCH"

Exclude the /usr/include/ from the include line and use the rest as include. E.g. if searching for IPV6_MULTICAST:

find  /usr/include/*|xargs grep -s -e "IPV6_MULTICAST"
/usr/include/i386-linux-gnu/bits/in.h:#define IPV6_MULTICAST_IF	17
/usr/include/i386-linux-gnu/bits/in.h:#define IPV6_MULTICAST_HOPS	18
/usr/include/i386-linux-gnu/bits/in.h:#define IPV6_MULTICAST_LOOP	19
/usr/include/linux/in6.h:#define IPV6_MULTICAST_IF	17
/usr/include/linux/in6.h:#define IPV6_MULTICAST_HOPS	18
/usr/include/linux/in6.h:#define IPV6_MULTICAST_LOOP	19

Use the in6.h in /usr/include/linux:

#include <linux/in6.h>

Gnuplot

Tweaking Linux networking

Subversion

Contact

email: firstname.lastname@lut.fi

Lecturer

Jouni Ikonen

Room: 2514

Reception hours:

Assistant

Jussi Laakkonen

Room: 2517

Reception hour: Wednesday 1500 - 1600