in reply to Re: New at socket programming
in thread New at socket programming

Sorry, I meant to write print $line; instead of print = $line; So after this code "hears" something from the client, will it listen again for more data from the client or will it stop running?

Replies are listed 'Best First'.
Re: Re: Re: New at socket programming
by dws (Chancellor) on Apr 19, 2002 at 03:46 UTC
    What you've got should work. It's nearly identical to an example on page 192 of Advanced Perl Programming (which happened to be within reach).

    It will fail if a client connects, sends nothing, then closes the socket.

    What do you see happening?

      Ok. I guess I'll just have to make a live connection and try it out. My problem is that just connecting involves a lot of things. The machine that my code is to connect to is a Short Message Service Center (SMSC) of a local telco. I just wanted some assurance that the code wouldn't have to be run again after each time the SMSC accesses it. The actual program that I'm using is actually much longer than my example, but the structure is identical to what I showed you. So for as long as the client connects and sends SOMETHING, anything, then my code will continue to listen for the next piece of data from the client? Right? Thanks for your help.