# Quest, a computer role playing game system # Copyright (C) 2002 Willem Robert van Hage, details in the COPYING file. package client; use strict; use IO::Socket; use com; use xml; my ($host,$port,$handle); sub init { $host = shift; $port = shift } sub connect_server { $handle = IO::Socket::INET->new(Proto => "tcp", PeerAddr => $host, PeerPort => $port) or die "can't connect to $host $port, $!"; $handle->autoflush(1); } sub request { my $request = shift; connect_server(); com::send_string($handle,$request); return com::recv_string($handle) } 1;