Hello,

Apparently you're using an old version of IO::Socket that does not turn
autoflushing on by default.  To turn it on, use:
$sock->autoflush(1);

Here is a sample server:


use IO::Socket;
my $sock = new IO::Socket::INET(LocalPort => 5500, Listen => 5, Reuse => 1)
   or die "Cannot listen $!\n";
while(defined(my $s = $sock->accept)){
    $s->autoflush(1); # try using 1 for flush, 0 for buffer
    for(1..10){
        print $s "Hello $_ "; # no \n here, and it works
        sleep 1;
    }
    close $s;
}

Hope this helps,,,

Aziz,,,


In article <[EMAIL PROTECTED]>, "Silvio Luis Leite
Santana" <[EMAIL PROTECTED]> wrote:

> Hello all
> 
> Trying to learn a bit of networking,
> I am using the module IO::Socket::INET just as shown in the camel book
> (3rd edition) pg 439-441.
> 
> I have a client process (that sends data), and a server (that receives
> those data).
> 
> I send data from the client to server with the lines:
> 
> $mensagem = "10-bytes-of-data";
> print $servidor $mensagem;
> 
> But I am realizing that the data aren't being sent, unless they're
> ending with "\n".
> 
> I have tried to turn on autoflush, like:
> 
> select $servidor;
> $| = 1;
> 
> But even so it didn't work.
> 
> The question is: how can I send the data immediately?
> 
> I can send the source codes of both client and server on request
> (they're small, but are very similar to the codes on the camel book).
> 
> Thanks in advance,
> Silvio.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to