Don't comment the topic if you have a new question.
You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.
By fbertoli, 18 March, 2011
In the standard way of working, the setup of the communciation channel requests that the server (the meter) listen at a given port and the client (the AMR) connect to such port.
With this way of working the server should be always up and running.
In some circumstances that is not possible, specially with gas meters.
In such cases there should be another way to setup the communication channel: I wonder, the solution should be to reverse the role at tcp/ip level, so that the client listen to a given port and the server, whenever waked up, connect to such port.
Could you confirm if this solution design could be implemented with GXCom?
I believe yes because such library can be used indifferently for client or server side.
Thanks in advance for your answer.
on 21st March, 2011 fbertoli wrote: quote start--------------------
First of all thanks for your answer.
If we want to implement a data collection process having all the meters connected to the same server (host+port) with meters executing tcp/ip connect scheduled along a time window, with i.e. 100 parallel connection requests, and the data collector machine executing tcp/ip accept, how can we implement such scenario using GXNet and GXCom?
I know GXNet can have a queue of connection requests but I suppose it cannot support parallel execution implemente by thread or process such like the fork/exec unix style.
Thanks. quote end--------------------
Client/Server in TCP/IP connections
Hello fbertoli,
sorry it took over the weekend to answer to Your post.
Yes, both GXNet (media component for making a connection) and GXCom, support the requested feature, and can be used as a server.
post by Member "fbertoli" moved into relevant thread
on 21st March, 2011 fbertoli wrote:
quote start--------------------
First of all thanks for your answer.
If we want to implement a data collection process having all the meters connected to the same server (host+port) with meters executing tcp/ip connect scheduled along a time window, with i.e. 100 parallel connection requests, and the data collector machine executing tcp/ip accept, how can we implement such scenario using GXNet and GXCom?
I know GXNet can have a queue of connection requests but I suppose it cannot support parallel execution implemente by thread or process such like the fork/exec unix style.
Thanks.
quote end--------------------
GXCom server
Hi,
Here is a sample code that implements echo server.
I believe that it is best if you start from this.
Happy Coding,
Mikko
private void StartEchoServer()
{
//Change to right values.
//cl.SetBOP(0x1, Gurux.Common.VariantType.UInt8);
//cl.SetEOP(0x3, Gurux.Common.VariantType.UInt8);
//cl.SetChecksumParameters(-1, Gurux.Common.Checksum.Fletcher, 0, -1, 0, 0, 0, 0, false, false);
Gurux.Net.GXNet media = (Gurux.Net.GXNet)cl.SelectMedia("Net");
media.Protocol = Gurux.Net.NetworkType.Tcp;
media.ServerPort = 1000;
media.Server = true;
cl.AssignMedia(media);
cl.OnReceived += new Gurux.Client.ReceivedEventHandler(cl_OnReceived);
cl.OnError += new Gurux.Client.ErrorEventHandler(cl_OnError);
cl.MediaOpen();
}
///
///
void cl_OnError(Gurux.Client.GXClient sender, string errorInfo)
{
MessageBox.Show(this, errorInfo);
}
///
///
void cl_OnReceived(Gurux.Client.GXClient sender, Gurux.Packet.GXPacket packet, bool answer)
{
try
{
sender.Send(packet, false, packet.SenderInfo);
}
catch (Exception Ex)
{
cl_OnError(sender, Ex.Message);
}
}