in reply to Socket buffer issue

«<Impact>» reads until a newline is received. If the first message is "blank", it's because there was nothing before the first newline.

Update: Well, that's not right. (Tired today.) But then, neither is the question. What is this code you posted, and why isn't it the code that exhibits the problem? You only have one read, yet you talk of the wrong read getting the data you want.

Update: By the way, IO::Socket::INET greatly simplifies the socket creation.

use IO::Socket::INET qw( ); my $sock = IO::Socket::INET->new( Proto => 'tcp', PeerHost => 'axtcnr:6540', ) or die("Can't connect to axtcnr:6540: $!\n");

($sock is already set to autoflush.)

Replies are listed 'Best First'.
Re^2: Socket buffer issue
by goosesganders (Initiate) on Apr 01, 2011 at 02:30 UTC
    That is the correct code. We are picking up individual time stamp files. I only put the piece of code in that I am having issues with but I am picking up all the transactions that are in the directory storing them in an array and pushing them across one at a time. So I connect, check to see the file meets my requirement, push it across, and wait for acknowledgment. If the array stores one file I get a blank response. If I have two or more files the first response is blank and all responses that follow are the acknowledgment for the previous file. I am using a foreach loop based on the transaction array.
      The problem is on the server side.
        Why do you say it is a server issue? Because they are sending a blank statement followed by a line break? Is there a way to work around that because I don't think I am going to get them to change their code based on previous conversations with them. Thanks.