Sunday, June 21, 2009

english

Here are the basic rules for when to use "A, An or The":

  • a = indefinite article (not a specific object, one of a number of the same objects) with consonants
    Eric has a dog.
    Gregory works in a factory.
  • an = indefinite article (not a specific object, one of a number of the same objects) with vowels (a,e,i,o,u)
    Can I have an apple?
    Donata is an English teacher.
  • the = definite article (a specific object that both the person speaking and the listener know)
    The car over there is fast.
    The teacher is very good, isn't he?
  • The first time you speak of something use "a or an", the next time you repeat that object use "the".
    I live in a house. The house is quite old and has two bedrooms.
    I ate in a Vietnamese restaurant. The restaurant was not very clean.
  • DO NOT use an article with countries, states, counties or provinces, lakes and mountains except when the country is a collection of states such as "The United States".
    My uncle lives in Cumbria near Lake Windermere.
    They live in Bristol.
  • Use an article with bodies of water, oceans and seas -
    I live on a small island in the Baltic Sea.
  • DO NOT use an article when you are speaking about things in general
    I like Indian tea.
    Simon likes reading books about linguistics.
  • DO NOT use an article when you are speaking about meals, places, and transport
    He has breakfast at home.
    I go to university.
    Magda comes to work by taxi.

Wednesday, June 10, 2009

Must read

1. Must read about vlan 
3. dos attack
4. sack (TCP) v v imp
5. window scal factor

Thursday, June 4, 2009

public key encryption

1. what is "public key encryption" ?

Monday, May 25, 2009

socket programming

http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#intro

What is the difference between SO_REUSEADDR and SO_REUSEPORT?

SO_REUSEADDR allows your server to bind to an address which is in a   TIME_WAIT state.  It does not allow more than one server to bind to   the same address.  It was mentioned that use of this flag can create a   security risk because another server can bind to a the same port, by   binding to a specific address as opposed to INADDR_ANY.  The   SO_REUSEPORT flag allows multiple processes to bind to the same   address provided all of them use the SO_REUSEPORT option.    From Richard Stevens (rstevens@noao.edu):    This is a newer flag that appeared in the 4.4BSD multicasting code   (although that code was from elsewhere, so I am not sure just who   invented the new SO_REUSEPORT flag).    What this flag lets you do is rebind a port that is already in use,   but only if all users of the port specify the flag.  I believe the   intent is for multicasting apps, since if you're running the same app   on a host, all need to bind the same port.  But the flag may have   other uses.  For example the following is from a post in February:    From Stu Friedberg (stuartf@sequent.com):         SO_REUSEPORT is also useful for eliminating the        try-10-times-to-bind hack in ftpd's data connection setup        routine.  Without SO_REUSEPORT, only one ftpd thread can        bind to TCP (lhost, lport, INADDR_ANY, 0) in preparation for        connecting back to the client.  Under conditions of heavy        load, there are more threads colliding here than the        try-10-times hack can accomodate.  With SO_REUSEPORT, things        work nicely and the hack becomes unnecessary.    I have also heard that DEC OSF supports the flag.  Also note that   under 4.4BSD, if you are binding a multicast address, then   SO_REUSEADDR is condisered the same as SO_REUSEPORT (p. 731 of "TCP/IP   Illustrated, Volume 2").  I think under Solaris you just replace   SO_REUSEPORT with SO_REUSEADDR.    From a later Stevens posting, with minor editing:    Basically SO_REUSEPORT is a BSD'ism that arose when multicasting was   added, even thought it was not used in the original Steve Deering   code.  I believe some BSD-derived systems may also include it (OSF,   now Digital Unix, perhaps?).  SO_REUSEPORT lets you bind the same   address *and* port, but only if all the binders have specified it.   But when binding a multicast address (its main use), SO_REUSEADDR is   considered identical to SO_REUSEPORT (p. 731, "TCP/IP Illustrated,   Volume 2").  So for portability of multicasting applications I always   use SO_REUSEADDR. 

What exactly does SO_REUSEADDR do

This socket option tells the kernel that even if this port is busy (in   the TIME_WAIT state), go ahead and reuse it anyway.  If it is busy,   but with another state, you will still get an address already in use   error.  It is useful if your server has been shut down, and then   restarted right away while sockets are still active on its port.  You   should be aware that if any unexpected data comes in, it may confuse   your server, but while this is possible, it is not likely.    It has been pointed out that "A socket is a 5 tuple (proto, local   addr, local port, remote addr, remote port).  SO_REUSEADDR just says   that you can reuse local addresses.  The 5 tuple still must be   unique!" by Michael Hunter (mphunter@qnx.com).  This is true, and this   is why it is very unlikely that unexpected data will ever be seen by   your server.  The danger is that such a 5 tuple is still floating   around on the net, and while it is bouncing around, a new connection   from the same client, on the same system, happens to get the same   remote port.  This is explained by Richard Stevens in ``2.7 Please   explain the TIME_WAIT state.''.