in reply to Re^2: Is it possible to create a socket client and server that can send information back and forth using IO::Socket?
in thread Is it possible to create a socket client and server that can send information back and forth using IO::Socket?

Assuming you meant to send a newline after the HELLO,

Side that initiates the handshake:

print $sock "HELLO 1.0"; chomp( my $greet = <$sock> ); die if $greet ne 'HELLO 1.0'; ...continue...

Side that responds to the handshake:

chomp( my $greet = <$sock> ); die if $greet ne 'HELLO 1.0'; print $sock "HELLO 1.0"; ...continue...

Without the newline, you'll need touse something other than <>. It won't return until a newline is received (by default).

  • Comment on Re^3: Is it possible to create a socket client and server that can send information back and forth using IO::Socket?
  • Select or Download Code