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: Stuart Booth
  • Date: Tue, 16 Sep 2003 15:30:00 +0000

On Tue, 16 Sep 2003 09:44:49 -0400, "<a
href="/group/xAP_developer/post?postID=C9nzJJM8Ss1aO_fBgr0bulaIHO12iekBPRux97g_5bUZJs4TYnRwNhF9WscgnMdl3AiVABGgA70">i.bird@t...</a>"
<<a
href="/group/xAP_developer/post?postID=ZOuFXFHJgnF9pREOMQeRxraSGWt38b8joAu2fVpHoNPI7rXaXksDVimisMZhyc8nb64FaZMVXqc2hg">Ian@M...</a>>
wrote:

>So, if my little device opened 3639 for listening which xAP messages
would
>it 'hear'?

All of them!

>If your hub also was listening on 3639 and another one of your
>applications sent data on 3640 what would hear it? Does the hub repeat
data
>from one port to another? What does a hub actually do?

Mark's covered that one.

>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.

If you closed/reopened you might miss messages. I run the sending on a
completely different port than the listener is sitting on. As Mark
said, this could just as easily by 9999 as 3640.

The only port number I'm ever truly interested in, apart from 3639 to
actually receive xAP messages, is the listening port of a Hub Client
application.

This information gets transmitted in the Port=XXXX line of a heartbeat
message, so that the Hub knows where to forward on its received
messages (from port 3639).

The rest of the time I see a port number, frankly it's irrelevant to
me, and I've not used this information in any way. My Listener app
displays this info but serves me little purpose that I can recall.

> There would never be
>contension as in a PC since I am in control of everything so no
competing
>applications. How on earth does full duplex work in this port jungle?

My xAPListener class in my code listens asynchronously on its own
thread. As data arrives it reads in the message, builds a xAPMessage
object containing the data and then passes it off to interested
parties in the application in the form of events that they can
register interest in. This way I can do both my receiving and sending
time-sliced to effectively be at the same time.

>> So the transmission port is really irrelevant, it's the listening
port
>> that's important.
>
>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?

Perhaps the sending on 3640 and up serves to confuse the matter. But
you're absolutely right in the above, and as Mark said it could just
as easily be port 9999 a message is sent from.

In my very absolute first bash at my xAPFramework code, when I was
working out exactly the same as you are here, I used to create a
sender object each individual time I wanted to send a message, or a
heartbeat for that matter.

The sender object opens a port, sends a message, and closes the port
again when you're done with the sender object.

It was very strange watching in my Hub I think it was, seeing messages
come from ever increasing port numbers; 5662, 5663, 5664, and so on. I
guess somewhere in the .net or Windows system it just incremented the
next available port counter of some kind, and eventually the
unused/closed ports would get recycled.

Anyway, I didn't like that at all and changed my test app to start
creating a xAPSender object and leaving it around for the lifetime of
the application, so that it always sends on the same port. Then Kevin
suggested opening transmission ports from 3640 onwards.

S
--
Stuart Booth
xAPFramework.net - a reusable xAP framework for .net

<a href="http://www.xapframework.net/";>http://www.xapframework.net/</a>
<a
href="/group/xAP_developer/post?postID=iEQFS1347tH5SmHPp_1xwOuKA_DQlRfLlhyRTfnSo2khBgJNPfUcQicE9jZcrSWjgz9C96TQ9fN0ZPWjS40">stuart@x...</a>





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.