Will MQTT topic subscribe occupies a new port?

40 views
Skip to first unread message

Koma Yip

unread,
Jul 6, 2017, 10:02:52 PM7/6/17
to MQTT
Hi all, I just want to know when subscribing a topic , will a new port is occupied between the client and the broker? Thanks

Thomas

unread,
Jul 7, 2017, 7:25:50 AM7/7/17
to MQTT
Hi Koma,

No, there is only one TCP/IP connection between the server and the client, regardless of the number of subscriptions.


Thomas

Gambit Communications

unread,
Jul 17, 2017, 9:19:57 AM7/17/17
to MQTT

It is actually an implementation issue how many TCP connections are used by
a client. Consider a multi-homed, multi-threaded subscriber multiplexing
subscriptions over more than one TCP connection, for whatever reason (levels
of service, load-balancing over layer 2 interfaces, etc).

Paul Fremantle

unread,
Jul 17, 2017, 9:39:01 AM7/17/17
to mq...@googlegroups.com
No, it happens using the existing TCP connection.

Paul

On 7 Jul 2017 3:02 am, "Koma Yip" <kom...@gmail.com> wrote:
Hi all, I just want to know when subscribing a topic , will a new port is occupied between the client and the broker? Thanks

--
To learn more about MQTT please visit http://mqtt.org
---
You received this message because you are subscribed to the Google Groups "MQTT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+unsubscribe@googlegroups.com.
To post to this group, send email to mq...@googlegroups.com.
Visit this group at https://groups.google.com/group/mqtt.
For more options, visit https://groups.google.com/d/optout.

Paul Fremantle

unread,
Jul 17, 2017, 9:44:15 AM7/17/17
to mq...@googlegroups.com
That is not true. The definition of an MQTT client is that it has a connection to the broker. If another connection is made with the same ClientID then the old connection is automatically terminated by the broker. What you are describing is something that would need a new name and could not be described as an "MQTT Client" according to the specification.

Paul

--
To learn more about MQTT please visit http://mqtt.org
---
You received this message because you are subscribed to the Google Groups "MQTT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+unsubscribe@googlegroups.com.
To post to this group, send email to mq...@googlegroups.com.
Visit this group at https://groups.google.com/group/mqtt.
For more options, visit https://groups.google.com/d/optout.



--
Paul Fremantle
Doctoral Researcher, University of Portsmouth, School of Computing
Visiting Scientist, Institute of the Architecture of Application Systems, Stuttgart
Visiting Lecturer, Software Engineering Programme, Oxford University
Co-Founder, WSO2
Apache Member and Committer
twitter: pzfreo / skype: paulfremantle / blog: http://pzf.fremantle.org

Vardharajulu

unread,
Jul 17, 2017, 10:22:26 AM7/17/17
to MQTT

MQTT lies above the transport layer. TCP ports are defined in the transport layer. The port is used for the TCP connection between broker and client. All the other control packets of MQTT (including connect and disconnect packet of MQTT) are messages of a TCP connection. MQTT Connect packet retains TCP connection and Disconnect packet close the TCP connection. MQTT SUBSCRIBE, PUBLISH are just a transport layer message.


Vardharajulu K N,
Technical Architect,
Bevywise Networks, India.

Gambit Communications

unread,
Jul 17, 2017, 10:35:41 AM7/17/17
to MQTT
You are correct using the narrow interpretation of "client". One client session / ClientID, one TCP connection.
The original post did not restrict to one client ID, and I used the application-centric concept of "client"
to mean "client application".
A client application can open multiple client sessions, each one using one and only one transport connection.
Thank you for the clarification.


On Monday, July 17, 2017 at 9:44:15 AM UTC-4, Paul Fremantle wrote:
That is not true. The definition of an MQTT client is that it has a connection to the broker. If another connection is made with the same ClientID then the old connection is automatically terminated by the broker. What you are describing is something that would need a new name and could not be described as an "MQTT Client" according to the specification.

Paul
On 17 July 2017 at 14:19, Gambit Communications <gambit.com...@gmail.com> wrote:

It is actually an implementation issue how many TCP connections are used by
a client. Consider a multi-homed, multi-threaded subscriber multiplexing
subscriptions over more than one TCP connection, for whatever reason (levels
of service, load-balancing over layer 2 interfaces, etc).

--
To learn more about MQTT please visit http://mqtt.org
---
You received this message because you are subscribed to the Google Groups "MQTT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+uns...@googlegroups.com.

To post to this group, send email to mq...@googlegroups.com.
Visit this group at https://groups.google.com/group/mqtt.
For more options, visit https://groups.google.com/d/optout.

Paul Fremantle

unread,
Jul 17, 2017, 12:14:11 PM7/17/17
to mq...@googlegroups.com
Completely agreed! 

Paul

To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+unsubscribe@googlegroups.com.

To post to this group, send email to mq...@googlegroups.com.
Visit this group at https://groups.google.com/group/mqtt.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages