Hylafax Mailing List Archives
|
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
Re: Writing a HylaFAX client...
Jonathan Chen <jonc@pinnacle.co.nz> writes:
> Hi y'all,
>
> I'm seriously thinking of writing Yet-Another-HylaFAX-Client, but
> the main problem I have at the moment is that I don't quite understand
> just how the data-transfer from client -> host works at the moment.
Hi Jonathan. You need to read rfc959, the FTP protocol
specification. Sam's HylaFAX protocol is very closely based on this.
If you can find a library for your chosen client platform and language
which implements the FTP protocol, yet is itself extensible, you may
be able to cut a lot of corners.
For example, I have done this in perl using Net::FTP, and found it
pretty easy.
> The control stuff looks pretty simple. It's the PORT command that
> throws me somewhat. "127,0,0,1" refers to localhost IP-address, and
> the last 2 numbers "7,67" (for the document) and "7,69" (for the
> cover page) probably refers to the data port. The questions are:
>
> 1. how does "7,67"/"7,69" translate to a data-port?
> 2. And where did the client come up with that number? I was
> always under the impression that the server had to be `listen'ing
> on a particular port for a client connection; but nowhere in
> the transcript did the HylaFAX server indicate which port the
> client should use.
>From rfc959, section 4.1.2
DATA PORT (PORT)
The argument is a HOST-PORT specification for the data port
to be used in data connection. There are defaults for both
the user and server data ports, and under normal
circumstances this command and its reply are not needed. If
this command is used, the argument is the concatenation of a
32-bit internet host address and a 16-bit TCP port address.
This address information is broken into 8-bit fields and the
value of each field is transmitted as a decimal number (in
character string representation). The fields are separated
by commas. A port command would be:
PORT h1,h2,h3,h4,p1,p2
where h1 is the high order 8 bits of the internet host
address.
I think the client typically comes up with that number by creating a
"listen" socket at the same address as the client end of the command
socket which is talking to the ftp daemon.
-phil
--
Phil Abercrombie
+64 4 495 5126