[Top] [All Lists]

Re: TCP/IP client

Subject: Re: TCP/IP client
From: Octavian Rasnita
Date: Wed, 10 Jun 2009 08:40:57 +0300
Newsgroups: perl.beginners

From: "Chas. Owens" <chas.owens@xxxxxxxxx>
2009/6/9 Octavian RÃÅniÅÄ <orasnita@xxxxxxxxx>:

I need to create a TCP/IP client that connects to a server which accepts
messages made from 3 parts:
- a static start string of 9 bytes;
- the body (that can have a variable length)
- a static string of 9 bytes.

...and then it gives a response that I need to get.

I've searched the CPAN for a higher level module that can help me to create
that client, but I couldn't find anything higher level than

Does anyone know a higher level module that can be used to create such a
TCP/IP client?

What could do what you want and be higher level?  You aren't using a
known protocol, so there will be no help there.  All you are doing is
connecting a server printing 9 bytes, a variable number of bytes, then
another 9 bytes, and then reading a number of bytes from the server.
You don't need any higher level of abstraction than a file handle
(which is effectively what IO::Socket gives you).

Chas. Owens

Hi Chas,

I was hoping that I could find a module that allows me to do something like:

use The::Module;

my $client = The::Module->new(PeerAddr => 'localhost:9000');

$client->send('those 3 parts of the message I want to send');

while ($client->eof) {
my $result = $client->receive();

(The code might not be a good one, but I think you understand what I want.)

Or can you give or tell me where I can find an example about how to create this simple client using IO::Socket::INET?

IO::Socket::INET doesn't give too many details about the methods it supports, and I need to also study IO::Socket, and Socket and finally many other built in perl functions or perlipc. I will study them, but I told I was searching for a higher level module because I am sure I will need just a few methods from all those offered by IO::Socket::INET.



<Prev in Thread] Current Thread [Next in Thread>