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

Hi Monks,

I have a perl code that uses Net::TFTPd.
The problem is that I want the TFTP server to listen to internal application that runs under Win2K OS, because of that I cannot use IO::socket since it's going through the Win sockets.
Doed anyone have an idea how to make the Net::TFTPd server listen to the internal application instead of listening to the PC NICs ?
The relevant code form the Net::TFTPd module, that uses the IO::Socket is:

# open socket if(my $udpserver = IO::Socket::INET->new(%params)) { $udpserver->setsockopt(SOL_SOCKET, SO_RCVBUF, 0); $udpserver->setsockopt(SOL_SOCKET, SO_SNDBUF, 0); $self->{'_UDPSERVER_'} = $udpserver; return(1); } else { $LASTERROR = "Error opening socket for reply: $@\n"; return(undef); }
Thanks,
Mosh.

Replies are listed 'Best First'.
Re: Can't use IO::Socket, need an alternative.
by starbolin (Hermit) on Mar 02, 2005 at 18:29 UTC

    There are big chunks here I'm missing as I'm not a Windows user. I'm trying to think abstraction layers here. TFTP is Layer 4, Transport, and uses socket() to communicate with Layer 3. I've looked through TFTPd and don't see a problem there as it's mostly an overload on your system's socket() call. Which I would think would be compiled to point to winsock?

    If your TFTP server is listening on localhost and your application is requesting from localhost then you should have a datastream. Have you tried makeing TFTPd do:

    Gratuitous perl snipit here:

    $sock = IO::Socket::INET->new(LocalAddr =>'localhost', LocalPort => '69', Proto => 'udp');

    I was assuming you are merely trying to serve your TFTP aware client locally instead of remotely. If not; could give me more information on what you're trying to do. What library is your application using to communicate? What protocol?