The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: An Ethernet question


  • Subject: Re: An Ethernet question
  • From: mark_harrison_uk2
  • Date: Tue, 16 Sep 2003 15:04:00 +0000

--- In <a
href="/group/xAP_developer/post?postID=7l7PHBA_yFCswO6Q6PSk5LWLz7Wc9bREnj3rhITMee5nAr6PiNBiEFahmPia9j6q-WMcucDf_N-JNaqdnnxWA9EkwJHleQ">xAP_developer@xxxxxxx</a>,
"i.bird@t..." <Ian@M...> wrote:
> > xAP's port is 3639 if memory serves.
> > The xAP Hub opens port 3639 for listening. The xAPSender class in
my
> > framework that I snatched the code below from attempts to open a
port
> > to send on, starting from either 3639 or 3640 more likely. When
it
> > succeeds in this it has found an unused port it can write out on.
>
> > Originally I just let the sender class open any port it cared to,
but
> > Kevin I think it was suggested working up from the official xAP
port#.
>
> So, if my little device opened 3639 for listening which xAP
messages would
> it 'hear'?

OK - there are actually TWO ports involved in any message.

A sender application sends FROM an IP address / sender port
combination.
A listener application listens ON an IP address / listener port
combination.

Ports are a standard part of IP, and allow different network services
to run on the same machine. For example, port 25 is typically used
for SMTP mail, and port 80 for HTTP.

Only one application (piece of code) can listen on a given port at
any one time. For example, a web server listens on port 80 all the
time - but if you try to start up a second web server, you need to
give it a different port number.

The way that xAP gets round this problem is by having a hub. A hub
will "open port 3639 for listening". It will then relay anything
it
gets to the other xAP applications that have registered with it as
also running on that machine.

A SENDER application can send from pretty much any available port,
but must send TO port 3639. The fact that they send FROM 3639 is a
programmer choice, not something that the IP port system, or for that
matter the xAP spec requires.

On any given PC, the listener ports and the sender ports are
completely different. Just because application A is listening on port
X doesn't mean that application B can't SEND on port X. What
application B _can't_ do is LISTEN on port X.

Think of a typical UDP message as being:

- FROM: Port 1234 @ 192.168.0.1
- TO: Port 3639 @ 192.168.0.255

All that the xAP listener cares about is the port number in the TO:
field.

> If my device wanted to send data would it close 3639 for listening
and send
> on the same port or send on another port number.

You don't need to close port 3639 for listening.

> How on earth does full duplex work in this port jungle?

It doesn't. Listener port 3639 is a completely different system
resource to sender port 3639.

>
> > So the transmission port is really irrelevant, it's the listening
port
> > that's important.

Yup.

> Does this mean that all devices will hear a xAP message (or
anything else)
> sent on port 3640 (or any other) even though they are listening on
port
> 3639?

Sent FROM port 3640 or port 3641 or for that matter port 9999.
Sent TO port 3639 is the important bit.

Regards,

Mark






xAP_Development Main Index | xAP_Development Thread Index | xAP_Development Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.