Perl and Sockets

Z

Zev G.

Hi

I am working on a new project and the need to code in Sockets came up.
I have also been told that the nature of sockets entails multi-
threading. In other words, if my program is listening for a call, I
need to make sure the user can use the computer for other stuff. I
have never done either of them. Someone refered me to Perl which I
have not used since college. I understand Perl is easy to brush up on
and pick up and it has a wrapper for sockets. Does this wrapper also
handle the threads? Will using Perl for sockets entail a much shorter
learning curve that something like, say, VB.

Thank you in advance. Any help would be apprecisted.

Zev
 
X

xhoster

Zev G. said:
Hi

I am working on a new project and the need to code in Sockets came up.
I have also been told that the nature of sockets entails multi-
threading. In other words, if my program is listening for a call, I
need to make sure the user can use the computer for other stuff.

Pretty much any modern general-purpose OS these days is multi-tasking,
so using the computer for other stuff is not a problem. Using the
same *program instance* for other stuff could be, though. Is that what
you meant?

If so, you don't necessarily need threads to do that. You can use
IO::Select or nonblocking IO instead.
I
have never done either of them. Someone refered me to Perl which I
have not used since college. I understand Perl is easy to brush up on
and pick up and it has a wrapper for sockets. Does this wrapper also
handle the threads?

In my opinion, Perl threads are not (yet) suitable for serious work.

Xho
 
Z

Zev G.

not sure what a program instance is. I am told that as opposed to
other kinds of programs, a sockets program must make an API call to
Windows in order to listen for incoming communication. Doing this will
hog the processor and display an houglass and then they won't be able
to get any other work done unless you use threading. I am hoping to
find a way to avoid using threading, so I'm wondering if the perl
Sockets wrapper takes care of the threading needs for me.
 
X

xhoster

Please don't top post.
not sure what a program instance is.

I was going to call it a "process", but I didn't know how platform-specific
that terminology is. I figure "program instance" is the abstract way
to describe it. If you don't know what either of those means, I'm afraid
I'm not prepared to hold your hand throughout your entire adventure in
computer-land.

I am told that as opposed to
other kinds of programs, a sockets program must make an API call to
Windows in order to listen for incoming communication. Doing this will
hog the processor and display an houglass and then they won't be able
to get any other work done unless you use threading.

Either you were told incorrectly or you didn't understand what you were
told. You should direct your questions to the people who are telling you
this stuff. I'd rather not try to debate things with your boss using you as
an intermediary. Anyway, while I am typing this on my Windows machine, I
have a perl program waiting to accept a socket in another window. No hour
glass, no CPU hogging.

H:\>perl -le "use IO::Socket; my $foo=IO::Socket::INET->new(Listen=>5,
LocalPort => '9876') or die $@; my $c=$foo->accept(); print $foo; print $c"

I am hoping to
find a way to avoid using threading, so I'm wondering if the perl
Sockets wrapper takes care of the threading needs for me.

I don't think you have the necessary background to know what "taking care
of it for me" would look like. All you have is some vague boogie-man of
FUD.

Xho
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,248
Latest member
MagdalenaB

Latest Threads

Top