http://www.perlmonks.org?node_id=497150

didier has asked for the wisdom of the Perl Monks concerning the following question:


Hello,

I was using Win32::SerialPort to speak, over a phone line, with a data service without any problem.
Now I need to set up a service...
I know that I can configure an XP box to link modem's inbounds calls to a TCP interface on server side, but I hope a better solution.
So my question is: is someone knows how to listen the modem for incoming call and how to get the line using Perl ?

Thanks.

Replies are listed 'Best First'.
Re: Win32::SerialPort server side
by splinky (Hermit) on Oct 04, 2005 at 14:43 UTC
    If I understand your question, you're saying that you have a Windows machine with a modem, and you want to write a program that will interface with the modem on that machine, and when someone dials into the modem, you want your Perl program to initiate a TCP connection to something else and bridge all input and output between the two. Right?

    If I got that part right, then I have to assume that you haven't done a lot of socket programming, and you're not sure how to handle listen to two things at once (the modem and the socket) so that you can effectively pass the data back and forth.

    If I guessed all that stuff right, then I think the answer you're looking for is in the modules IO::Select and IO::Socket. However, I know there used to be some problems with sockets under Windows, so check on that first. Also, you can check the fine tutorial Reading from more than one socket at once


      I guess my English is worst than I was thinking ;)

      I have two Win32 machines, each with a modem.
      The first one should dial the phone number of the second machine.
      I know how to use the Win32::Serialport to do that, and I know how to exchange data through a normal phone when you know the protocole at server side.

      I just need to know how the second machine can listen at the serial port and get the line if called.

      This is not "socket programmming". But handle socket and the modem at the same time has been done here before, see http://www.perlmonks.org/?node_id=353466

      Anyway, thank for your time splinky


      It seeems that the Telephony API of microsoft (TAPI) allows to listen at the serial port and thus take the line on call.
      But that TAPI is a mess of undocumented functions.
      Nobody had tried that before, using Win32::API call?