Re: IO::Socket problem how to receive data?

2002-09-02 Thread anthony

Hi,


I've read the perl doc but it was not usefull any how i fixed it, what i was
trying to do is to send data from a Visual basic program to a perl program,
then from perl to a visual basic program

thanx anyways guys,
Anthony



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




Re: IO::Socket problem how to receive data?

2002-09-02 Thread James Edward Gray II

I'm not sure I totally understand all of your question, but talking over 
an IO::Socket is pretty darn simple, if we're talking about a line 
oriented protocol.  You can use what you have always used for Perl input 
and output:

use IO::Socket::INET;
my $socket = IO::Socket::INET->new( PeerAddr=> $server,
  PeerPort  => 
$port, )
or die "Socket Error:  Unable to connect to host.";
# and then simply...
print $socket "$line to send\n";  # send a line
my $line_read = <$socket>;  # read a line

I'm not sure exactly what you meant by translating the data, but a 
common socket problem in that the talking program and the listening 
program are expecting different line endings, because of the platform 
they're running on.  UNIX systems use Line Feed (\012) as a line ending, 
Mac applications favor the Carriage Return (\015) though many Mac OS X 
programs are switching over to UNIX thinking, and Windows is usually 
looking for a Carriage Return followed by a Line Feed (\015\012).  Many 
networking protocols, including telnet, take the Windows road and look 
for both characters.  In that case, we have to change my above example a 
little:

use IO::Socket::INET (:DEFAULT :crlf);  # import a shortcut for both 
characters
local $/ = CRLF;  # sets reads to terminate after seeing both characters
my $socket = IO::Socket::INET->new( PeerAddr=> $server,
  PeerPort  => 
$port, )
or die "Socket Error:  Unable to connect to host.";
print $socket "$line to send", CRLF;  # we now end our lines with both 
characters
my $line_read = <$socket>;  # works because of the variable change above

Well, I hope that helps.  If I missed your problem, take another stab at 
explaining what's going wrong and I'll try again.  Good luck.

James

On Monday, September 2, 2002, at 09:09  AM, Felix Geerinckx wrote:

> Hi,
>
> I'm trying to learn IO::Socket and i have a little problem is that i DO 
> NOT
> know how to receive data i use the recv function but doesn't work at 
> all.
>
> I know how to send data- I know it works because it is a visual basic
> program that receives the data and it displays the correct data.
>
> But I can send data to a perl program but I don't know how to translate 
> it.
>
> Any HELP is REALLY appreciated.
>
> Anthony
>

James


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




Re: IO::Socket problem how to receive data?

2002-09-02 Thread Felix Geerinckx

on Sun, 01 Sep 2002 15:15:27 GMT, [EMAIL PROTECTED] (Anthony) wrote:

> I'm trying to learn IO::Socket and i have a little problem is that
> i DO NOT know how to receive data i use the recv function but
> doesn't work at all. 

[...]

> But I can send data to a perl program but I don't know how to
> translate it. 

Have you already checked out

perldoc perlipc

(especially the section on 'TCP Servers with IO::Socket')?

-- 
felix

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




IO::Socket problem how to receive data?

2002-08-31 Thread anthony

Hi,

I'm trying to learn IO::Socket and i have a little problem is that i DO NOT
know how to receive data i use the recv function but doesn't work at all.

I know how to send data- I know it works because it is a visual basic
program that receives the data and it displays the correct data.

But I can send data to a perl program but I don't know how to translate it.

Any HELP is REALLY appreciated.

Anthony



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