TWiki> INFBase Web>AnswersPage>YearThree (01 Nov 2011, Main.s0939860)EditAttach


Computer Communications and Networks (COM) - UDP Packet Loss?

For the 2nd coursework you've been asked to write a UDP client and server. People might be finding they're getting hideous packet loss, even when the network should be fine. Is it cheap CAT5 the university has installed? Not entirely...

It turns out most operating systems provide a rather small UDP packet buffer,

To find out on your current computer (if you're in linux), type:

 $> /sbin/sysctl -a | grep 'rmem_max' 
on this dice machine it's:
 net.core.rmem_max = 131071 
(which is 128kB).

To find out if this is the problem, the number of UDP packets being dropped is indicated by:

 netstat -s 
(find the line "packet receive errors" under "Udp"). If this number goes up when you run your server, you know that's the problem.

What does this mean for your coursework?

The upshot is your server might be sending huge amounts of data, far too quickly for the client to receive. Several solutions exist. The simplest (but not the most efficient) is to slow the rate of sending using (for example) a call to Thread.sleep(100) after each packet's been sent. This clearly isn't the most elegant solution. Other solutions might be for the server and client to decide on some limit on the number of UDP packets to be sent at any time.

For more information about the UDP buffer and more, see:

http://www.29west.com/docs/THPM/udp-buffer-sizing.html

-- MikeSmith - 23 Nov 2009

Sicstus and emacs

The sicstus interface is really horrible ^[[D^[[D^[[D^[[D^[[C^[[A^[[D happens a lot.

To avoid this, it's been suggested that you interface it with emacs (which is slightly less bad)...

1. First we need to find out where on the computer the sicstus addon for emacs is. To find it, type:

find | grep 'sicstus' | grep 'emacs'
it returns something like:
/opt/sicstus-4.0.4/lib/sicstus-4.0.4/emacs 
2. To use this edit the ~/.emacs (hidden) file in your home directory, eg:
nano ~/.emacs
3. Alter the 4th line, to now have the path to the addon. For example:
 (setq load-path (cons "/opt/sicstus-4.0.4/lib/sicstus-4.0.4/emacs" load-path))
4. Open a prolog file, e.g. by running:
emacs test1.pl
5. Choose the "consult->file" option from the "Prolog" menu!

6. Done big grin

More help, can be found at:

http://www.cs.bham.ac.uk/~pjh/prolog_course/using_sicstus/prolog_in_emacs.html

-- MikeSmith - 24 Nov 2009

Music in INFBase?

What music should I listen to in INFBase?

oumou sangare, ali farka toure, tiniwaren.

-- Mike and Jack's advice 2011. smile

Topic revision: r3 - 01 Nov 2011 - 18:17:21 - Main.s0939860
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
This Wiki uses Cookies