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: i.bird@xxxx
  • Date: Tue, 16 Sep 2003 14:44:00 +0000

> 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'? 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? Guess who didn't pay
attention when all this seemed like a distant runble that would never get
close to me.

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

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

Thanks

Ian (still very confused as to port relationships).





Original Message:
-----------------
From: Stuart Booth <a
href="/group/xAP_developer/post?postID=Lq8QrbZzEJPZY2VkD2adC9UzK_cIZlAFBBQZx-2IQawZA33mHOcIZ7qPhDYjTWpaCOWyHgs7Vu3oFYSuhRZPXQ">lists@x...</a>
Date: Tue, 16 Sep 2003 09:54:13 +0100
To: <a
href="/group/xAP_developer/post?postID=LGe_49mP2CzpZiE5xAc4vaOsSDvqi9U40EgNrGwbqiCA9abuhp8x9IDXhC7XOotFygic-4FPjD-1tLmcXspDmZHuHDlncQ">xAP_developer@xxxxxxx</a>
Subject: Re: [xAP_developer] An Ethernet question


On Tue, 16 Sep 2003 00:00:55 +0100, "Ian B" <<a
href="/group/xAP_developer/post?postID=K55haiqoPyIuT7OxNtiLqmajYgTi9-ofhm3bR2mvvFMcog_QOg2BIE6oyXXDcCrJCZGOdz2HZJMO7A">Ian@M...</a>>
wrote:

>I am still looking at this (perseverance!!) and I have a port question
or
>three.

I'll give them a go. I'm no network programming wiz. About all I've
really done so far, unfortunately, is my xAP stuff.

>What are they?

If I've understood your question correctly, every machine has a large
range of individual port numbers, 1 through 65536 I'd guess. Different
services listen on different port numbers, 20/21 for FTP, 80 for HTTP
I believe it is. xAP's port is 3639 if memory serves.

Is that what you meant?

>On my micro do I have to listen on the same port as you are
transmitting?

I seem to recall something about reading from and writing to the same
port but I can't recall the details. I don't with my software, I think
it will fail to open a port for transmission that has already been
opened for receiving.

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

> If
>so how do I know which one you are using? Is this the same port there
was
>discussion about earlier and it was assigned by some body or other.

Ahhh, the Hub protocol. Each of my Hub Client apps uses an instance of
a xAPListener derived class to receive messages. This will have
scanned up the range of ports looking for a free one to listen on in
much the same manner as the xAPSender class. Once it finds one the
client transmits this port number in the h/b so that the Hub knows
what port the client is listening on.

So it's in the process of finding a port that I can successfully open
that I determine which one I'll use. I don't know how that will
translate to your micro though!

If I recall correctly (I wrote this code in November last year) that's
how my Hub/Client auto-detection works. If port 3639 is unavailable it
starts as a HubClient application rather than a Hub, assuming that a
Hub is already running.

>I assume if IP is used there is no port number - is this correct?

No, I don't believe. You're connecting to a particular port on a
particular machine. Different ports require separate connections. UDP
broadcasts are still transmitted to a receiving port number.

One of these days I'll read up more on all of this, but I'm struggling
for time as it is already. Hey, Ian (Lowe :), sorry I haven't done
much on the xPL front yet. That's not through lack of interest I
assure you!! Too many projects and not enough spare time.

HTH?

S

>>-----Original Message-----
>>From: Stuart Booth [mailto:<a
href="/group/xAP_developer/post?postID=Lq8QrbZzEJPZY2VkD2adC9UzK_cIZlAFBBQZx-2IQawZA33mHOcIZ7qPhDYjTWpaCOWyHgs7Vu3oFYSuhRZPXQ">lists@x...</a>]
>>Sent: 11 September 2003 10:49
>>To: <a
href="/group/xAP_developer/post?postID=LGe_49mP2CzpZiE5xAc4vaOsSDvqi9U40EgNrGwbqiCA9abuhp8x9IDXhC7XOotFygic-4FPjD-1tLmcXspDmZHuHDlncQ">xAP_developer@xxxxxxx</a>
>>Subject: Re: [xAP_developer] An Ethernet question
>>
>>
>>On Thu, 11 Sep 2003 08:52:54 -0000, "Ian Bird" <<a
href="/group/xAP_developer/post?postID=K55haiqoPyIuT7OxNtiLqmajYgTi9-ofhm3bR2mvvFMcog_QOg2BIE6oyXXDcCrJCZGOdz2HZJMO7A">Ian@M...</a>>
>>wrote:
>>
>>>If so, when writing a PC based application do you somehow
specify the
>>>method used to send a xAP message in the program?
>>
>>I do. My framework code to send a message goes something like this:
>>
>>private void Connect ()
>>{
>> int port = xAPTransportInfo.GetListeningPort();
>> IPEndPoint ep = new IPEndPoint(IPAddress.Broadcast, port);
>>
>> UdpClient m_datagram = new UdpClient();
>> m_datagram.Connect(ep);
>>} // End of Connect
>>
>>public void Send (xAPMessage message)
>>{
>> byte[] msg =
Encoding.ASCII.GetBytes(message.ToRawMessageString());
>>
>> m_datagram.Send(msg, msg.Length);
>>} // End of Send
>>
>>So it's all encapsulated in the UdpClient class of the Microsoft
.net
>>Framework. More than that I haven't really needed to know. There
are
>>TcpClient classes as well which I use to communicate directly with
my
>>TiVo's YAC listener.

--
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=ZdMBfMfJqcSNQcZpVfDbqq8Tse_g7XyROrXiuH56J9AV_lUin5TaQ2pjASOwU7nYTXaDYfVFGkb_Hv2e74d5">stuart@x...</a>


To unsubscribe from this group, send an email to:
<a
href="/group/xAP_developer/post?postID=qPor9LAL8ckaVEeyQQzSIurwBZ5hQRChnSbuWkYfK5YyXE-oCNv2lZoSp0TBNSy_7McoTAgu9goR6nfhKAaC2bJpftC55rf2zcWJ-irwgs4">xAP_developer-unsubscribe@xxxxxxx</a>



Your use of Yahoo! Groups is subject to <a href="http://docs.yahoo.com/info/terms/";>http://docs.yahoo.com/info/terms/</a>



--------------------------------------------------------------------
mail2web - Check your email from the web at
<a href="http://mail2web.com/";>http://mail2web.com/</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.