Professional Web Applications Themes

2 Socket questions - PERL Beginners

hello, 1, how to use http 1.1 via IO::Socket? 2, if i have a script like this: &connectserver(); &answerserver(); &closeserver (); how to do a parallel processing while waiting for server response? use fork? thanks....

  1. #1

    Default 2 Socket questions

    hello,


    1, how to use http 1.1 via IO::Socket?

    2, if i have a script like this:
    &connectserver();
    &answerserver();
    &closeserver ();

    how to do a parallel processing while waiting for server response? use fork?

    thanks.
    Kelvin Guest

  2. #2

    Default RE: 2 Socket questions

    Kelvin Wu wrote: 

    Create a tcp connection to the server using IO::Socket->new and send the
    HTTP request. Read the response and handle it appropriately. Better yet, use
    a higher-level module like LWP::Simple or LWP::UserAgent for this.
     

    Erm, don't write subroutine calls like that anymore. Lose the &'s.
     

    That's an easy way to manage it.
    Bob Guest

  3. #3

    Default Re: 2 Socket questions

    On 2004-07-14, Kelvin Wu <com> wrote: 

    You let the HTTP::Daemon module do it for you.
     

    Forking would certainly work. perldoc perlipc contains some examples, I
    believe. There are also some articles at
    http://www.stonehenge.com/merlyn/WebTechniques/ that use HTTP::Daemon
    and a forking model.

    Lincoln Stein's excellent book "Network Programming with Perl" will
    prove usefull if you are going to do much multi-process/multiplexing
    network programming.
     

    Hope that helps a bit,

    -- Douglas Hunter
    Douglas Guest

Similar Threads

  1. Replies: 1
    Last Post: September 11th, 01:41 PM
  2. Replies: 8
    Last Post: August 25th, 03:47 PM
  3. Distinguishing between socket buffer full & socket disconnected
    By John Ramsden in forum PERL Miscellaneous
    Replies: 1
    Last Post: August 5th, 11:01 AM
  4. 2 questions :) - portal questions
    By John Weinshel in forum FileMaker
    Replies: 3
    Last Post: July 14th, 04:37 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139