#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2005
    Posts
    3
    Rep Power
    0

    help me in coding plzz ..urgent


    i am attaching the html documents for specification... to write the program...i tried to write but i got few errors..so some one help me to rectify those mistakes....below mentioned is the code i wrote .............

    #!/usr/bin/tclsh

    # Set your directory up here
    array set dirlist [list \
    localhost,9000 [list syllabus.pdf 1] \
    localhost,9001 [list syllabus.pdf 2] \
    ]

    set TypeDir "DIRECTORY"
    set ErBadReq "400 Bad request"

    socket -server accept 8003

    proc accept {sock addr port} {
    handleMessage $sock
    }

    proc handleMessage {sock} {
    set head [gets $sock]
    set type [lindex $head 0]
    if {[string equal $type $::TypeDir]} {
    directory $sock $head
    } else {
    puts $sock "$::ErBadReq\n"
    flush $sock
    close $sock
    return
    }
    }
    proc directory {sock head} {
    puts $sock "200 OK"

    set content ""
    foreach {i j} [array get ::dirlist] {
    set k [split $i ","]
    set i [lindex $k 0]
    set k [lindex $k 1]

    append content "$i $k [lindex $j 0] [lindex $j 1]\n"
    }
    puts $sock "Content-Length: [string length $content]\n"
    puts -nonewline $sock $content
    flush $sock
    close $sock
    }

    vwait done
    Attached Files
  2. #2
  3. (retired)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2003
    Location
    The Laboratory
    Posts
    10,101
    Rep Power
    0
    Maybe you should a) work out what language you're trying to use and b) try to do your own homework assignments.

    --Simon

    Comments on this post

    • CyBerHigh agrees
    • Yegg` agrees : Nice Bill Gates avatar. 8>
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2005
    Posts
    3
    Rep Power
    0
    already i tried that...but i need some sensible coding for that assignment to compare with mine.....so please as per the requirement...u sent few codings
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    461
    Rep Power
    25
    fist of all you really really need to start spelling things out and try to make your posts make a little sence.

    ALso, none of us want to do your homework, and no there is no requirment that we do anything for you. If you have a specific problem then ask, don't give us 25 lines of code and say fix it. ALso this is a python forum not a tcl forum. So your barking up the wrong tree anyway.
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Posts
    174
    Rep Power
    11
    yeah, the "urgent" and "immeditate" kind of gave that away.... these are forum keywords that say "I don't know what I'm doing and I don't want to learn why". sweet. good for you sir, good for you. see how many friends you make.

    sort of like: I want to lose weight but I don't want to exercise... the Weight is the problem, the Exercise is the programming
  10. #6
  11. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407
    You can always try hiring a programmer
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2004
    Location
    There where the rabbits jump
    Posts
    556
    Rep Power
    11
    well if he does not even tell us what he wants as a end result then not even a hired programmer can help him...
    Those people who think they know everything are a great annoyance to those of us who do.

IMN logo majestic logo threadwatch logo seochat tools logo