You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by Ben Hutcheson <be...@gmail.com> on 2023/01/07 07:01:35 UTC
Extending Configuration to include Connection String
Hi,
There's been a few times where I have had to pass the connection string
information through to the driver logic to be used in the connection phase.
For OPC-UA it's passed as a string through to the OPCUA device to help
select the correct endpoint. As well as now in the Profinet driver as we
need to create multiple sockets and use multiple protocols to create the
connection, some of which we need to know what interface we would like to
listen on.
I propose to extend the Configuration interface to include the connection
string information such as the ip address, port and transport. This way I'm
not recreating the getConnection logic for each driver.
What are peoples thoughts?
Ben
Re: Extending Configuration to include Connection String
Posted by Ben Hutcheson <be...@gmail.com>.
Hi,
Thanks Chris, yeah that's what I ended up doing, thanks.
Ben
On Sat, Jan 7, 2023 at 8:46 PM Christofer Dutz <ch...@c-ware.de>
wrote:
> Hi all and sorry for being late to the party ..
>
> I do think we had some reasoning behind not having this information in the
> Configuration. But it should also be possible to access the information in
> the driver.
> For example, in the ADS driver in the code for setting up the AMS routes I
> use this code to access the properties:
>
>
> SocketAddress localSocketAddress = context.getChannel().localAddress();
> InetAddress localAddress = ((InetSocketAddress)
> localSocketAddress).getAddress();
>
> Perhaps that helps?
>
> Chris
>
>
>
> From: jl hong <my...@gmail.com>
> Date: Saturday, 7. January 2023 at 10:46
> To: dev@plc4x.apache.org <de...@plc4x.apache.org>
> Subject: Re: Extending Configuration to include Connection String
> Hi Ben,
>
> In your case, it seems like a good idea to keep them in the
> Configuration.😎
>
> Jinlin
>
> Ben Hutcheson <be...@gmail.com> 於 2023年1月7日 週六 下午5:37寫道:
>
> > Hi Jinlin,
> >
> > Yeah we do parse the string and get those values, however currently we
> > don't save them in the configuration for later use.
> >
> > Although I have been playing around this morning with getting the values
> > from the netty channel that is created. I might just use this instead.
> >
> > thanks
> >
> > Ben
> >
> > On Sat, Jan 7, 2023 at 10:28 AM jl hong <my...@gmail.com> wrote:
> >
> > > Hi Ben,
> > >
> > > I see we parse the connection string as a URL, and it contains IP,
> port,
> > > and protocol. Did you mean we needn’t parse it again?
> > >
> > > Jinlin
> > >
> > > Ben Hutcheson <be...@gmail.com> 於 2023年1月7日 週六 下午3:05寫道:
> > >
> > > > Hi,
> > > >
> > > > There's been a few times where I have had to pass the connection
> string
> > > > information through to the driver logic to be used in the connection
> > > phase.
> > > > For OPC-UA it's passed as a string through to the OPCUA device to
> help
> > > > select the correct endpoint. As well as now in the Profinet driver as
> > we
> > > > need to create multiple sockets and use multiple protocols to create
> > the
> > > > connection, some of which we need to know what interface we would
> like
> > to
> > > > listen on.
> > > >
> > > > I propose to extend the Configuration interface to include the
> > connection
> > > > string information such as the ip address, port and transport. This
> way
> > > I'm
> > > > not recreating the getConnection logic for each driver.
> > > >
> > > > What are peoples thoughts?
> > > >
> > > > Ben
> > > >
> > >
> >
>
Re: Extending Configuration to include Connection String
Posted by Christofer Dutz <ch...@c-ware.de>.
Hi all and sorry for being late to the party ..
I do think we had some reasoning behind not having this information in the Configuration. But it should also be possible to access the information in the driver.
For example, in the ADS driver in the code for setting up the AMS routes I use this code to access the properties:
SocketAddress localSocketAddress = context.getChannel().localAddress();
InetAddress localAddress = ((InetSocketAddress) localSocketAddress).getAddress();
Perhaps that helps?
Chris
From: jl hong <my...@gmail.com>
Date: Saturday, 7. January 2023 at 10:46
To: dev@plc4x.apache.org <de...@plc4x.apache.org>
Subject: Re: Extending Configuration to include Connection String
Hi Ben,
In your case, it seems like a good idea to keep them in the
Configuration.😎
Jinlin
Ben Hutcheson <be...@gmail.com> 於 2023年1月7日 週六 下午5:37寫道:
> Hi Jinlin,
>
> Yeah we do parse the string and get those values, however currently we
> don't save them in the configuration for later use.
>
> Although I have been playing around this morning with getting the values
> from the netty channel that is created. I might just use this instead.
>
> thanks
>
> Ben
>
> On Sat, Jan 7, 2023 at 10:28 AM jl hong <my...@gmail.com> wrote:
>
> > Hi Ben,
> >
> > I see we parse the connection string as a URL, and it contains IP, port,
> > and protocol. Did you mean we needn’t parse it again?
> >
> > Jinlin
> >
> > Ben Hutcheson <be...@gmail.com> 於 2023年1月7日 週六 下午3:05寫道:
> >
> > > Hi,
> > >
> > > There's been a few times where I have had to pass the connection string
> > > information through to the driver logic to be used in the connection
> > phase.
> > > For OPC-UA it's passed as a string through to the OPCUA device to help
> > > select the correct endpoint. As well as now in the Profinet driver as
> we
> > > need to create multiple sockets and use multiple protocols to create
> the
> > > connection, some of which we need to know what interface we would like
> to
> > > listen on.
> > >
> > > I propose to extend the Configuration interface to include the
> connection
> > > string information such as the ip address, port and transport. This way
> > I'm
> > > not recreating the getConnection logic for each driver.
> > >
> > > What are peoples thoughts?
> > >
> > > Ben
> > >
> >
>
Re: Extending Configuration to include Connection String
Posted by jl hong <my...@gmail.com>.
Hi Ben,
In your case, it seems like a good idea to keep them in the
Configuration.😎
Jinlin
Ben Hutcheson <be...@gmail.com> 於 2023年1月7日 週六 下午5:37寫道:
> Hi Jinlin,
>
> Yeah we do parse the string and get those values, however currently we
> don't save them in the configuration for later use.
>
> Although I have been playing around this morning with getting the values
> from the netty channel that is created. I might just use this instead.
>
> thanks
>
> Ben
>
> On Sat, Jan 7, 2023 at 10:28 AM jl hong <my...@gmail.com> wrote:
>
> > Hi Ben,
> >
> > I see we parse the connection string as a URL, and it contains IP, port,
> > and protocol. Did you mean we needn’t parse it again?
> >
> > Jinlin
> >
> > Ben Hutcheson <be...@gmail.com> 於 2023年1月7日 週六 下午3:05寫道:
> >
> > > Hi,
> > >
> > > There's been a few times where I have had to pass the connection string
> > > information through to the driver logic to be used in the connection
> > phase.
> > > For OPC-UA it's passed as a string through to the OPCUA device to help
> > > select the correct endpoint. As well as now in the Profinet driver as
> we
> > > need to create multiple sockets and use multiple protocols to create
> the
> > > connection, some of which we need to know what interface we would like
> to
> > > listen on.
> > >
> > > I propose to extend the Configuration interface to include the
> connection
> > > string information such as the ip address, port and transport. This way
> > I'm
> > > not recreating the getConnection logic for each driver.
> > >
> > > What are peoples thoughts?
> > >
> > > Ben
> > >
> >
>
Re: Extending Configuration to include Connection String
Posted by Ben Hutcheson <be...@gmail.com>.
Hi Jinlin,
Yeah we do parse the string and get those values, however currently we
don't save them in the configuration for later use.
Although I have been playing around this morning with getting the values
from the netty channel that is created. I might just use this instead.
thanks
Ben
On Sat, Jan 7, 2023 at 10:28 AM jl hong <my...@gmail.com> wrote:
> Hi Ben,
>
> I see we parse the connection string as a URL, and it contains IP, port,
> and protocol. Did you mean we needn’t parse it again?
>
> Jinlin
>
> Ben Hutcheson <be...@gmail.com> 於 2023年1月7日 週六 下午3:05寫道:
>
> > Hi,
> >
> > There's been a few times where I have had to pass the connection string
> > information through to the driver logic to be used in the connection
> phase.
> > For OPC-UA it's passed as a string through to the OPCUA device to help
> > select the correct endpoint. As well as now in the Profinet driver as we
> > need to create multiple sockets and use multiple protocols to create the
> > connection, some of which we need to know what interface we would like to
> > listen on.
> >
> > I propose to extend the Configuration interface to include the connection
> > string information such as the ip address, port and transport. This way
> I'm
> > not recreating the getConnection logic for each driver.
> >
> > What are peoples thoughts?
> >
> > Ben
> >
>
Re: Extending Configuration to include Connection String
Posted by jl hong <my...@gmail.com>.
Hi Ben,
I see we parse the connection string as a URL, and it contains IP, port,
and protocol. Did you mean we needn’t parse it again?
Jinlin
Ben Hutcheson <be...@gmail.com> 於 2023年1月7日 週六 下午3:05寫道:
> Hi,
>
> There's been a few times where I have had to pass the connection string
> information through to the driver logic to be used in the connection phase.
> For OPC-UA it's passed as a string through to the OPCUA device to help
> select the correct endpoint. As well as now in the Profinet driver as we
> need to create multiple sockets and use multiple protocols to create the
> connection, some of which we need to know what interface we would like to
> listen on.
>
> I propose to extend the Configuration interface to include the connection
> string information such as the ip address, port and transport. This way I'm
> not recreating the getConnection logic for each driver.
>
> What are peoples thoughts?
>
> Ben
>