tcp-gateway | High performance TCP Gateway base on Netty | REST library
kandi X-RAY | tcp-gateway Summary
kandi X-RAY | tcp-gateway Summary
High performance TCP Gateway base on Netty 4 for request data or push message.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Channel read
- Convert byte array to hex string
- Push message
- Create session
- Get local host name
- Get local host by socket address
- Gets local address
- Get IP list by registry IP
- Send notification asynchronously
- Waits for the future to complete
- Do send message async
- Connect to the server
- Add session - created event
- Main loop
- Wait queue
- Initialize the channel
- Can telnet?
- Cancel this future
- Expire the session
- Called when a channel is inactive
- Initialize and start the tcp session listener
- Shutdown tcp server
- Start tcp server
- Matches an IP
- Get available port
- Send message
tcp-gateway Key Features
tcp-gateway Examples and Code Snippets
Community Discussions
Trending Discussions on tcp-gateway
QUESTION
I have a Modbus-RTU thats connected to a Modbus-RTU/TCP-Gateway, which i'm trying to call. Works fine, but I have to read multiple values each reading cycle.
I'm using the pymodbus library.
Say I have 3 Registers to read:
Address, WordLength
1: 0,2
2: 2,2
3: 206, 4
What I'm doing at the moment is calling the register values 1 and 2 together, by starting to read at adress 0, with a word count of 4. But then I have to make another request to register value 3.
Which means, when trying to timestamp the values I encounter the problem that they were actually not read at the exact same time.
The question: Is there a way to call multiple modbus registers simultaneously, say by calling read_holding_registers with a list of registers and a list of their respective word counts in python?
In a way that would work like this:
...ANSWER
Answered 2019-Nov-19 at 10:06Short answer: No, there is no way you can poll non-contiguous registers on a single Modbus query. That's a limitation of the Modbus protocol.
If your device (you don't mention what device in particular you are talking about, so from here on in I'll be guessing) sticks to the Modbus specification then the maximum number of registers you can interrogate on a single query is 125. That's required to comply with the maximum message length, which is 256 bytes according to the spec:
The quantity of registers to be read, combined with all other fields in the expected response, must not exceed the allowable length of Modbus messages: 256 bytes.
The lack of synchronization you mention is frequently overcome using one of the following two strategies:
-At the device (slave) level (for instance, if your device is a PLC where you have the freedom to program whatever you want in it) you sample all sensors (or those you need to keep in sync) at the same time and do not update again for a certain period of time to give room to the Master to read all data (most sensors are not that fast so this is in general not a problem for most industrial settings).
-At the master level, you can use a multithreading approach to launch two (or more) simultaneous queries (you need to somehow synchronize those queries). This only works for Modbus TCP devices that accept multiple simultaneous connections (most do). Since you seem to be working with the TCP side of your gateway, this solution might work for your time-stamping problem but be aware that, in essence, it would be just smoke and mirrors to keep the fantasy that your sensors are read in sync (not to mention it would be fancy smoke and mirrors because it would take some effort to come up with the code).
You should recoil a bit and ask yourself what is the reason to have your readings in sync. If you are in a hard real-time environment (where, for instance, you have to take measurements of two sensors at the exact same time because you need to make a calculation using both variables and they change really fast) you need to rethink your data acquisition system to use the first approach I mentioned above (read in sync and freeze).
I did not mention it earlier because I imagine you don't have access to the Modbus mapping of the final device, but if you do the trivial and smart thing to do is to reorganize the order of the registers according to your needs. Be sure to take a look at the manual of your unit, most high-end and/or real-time devices will actually allow you this kind of change (in an easy way I mean, changing the firmware will always fix your issue).
QUESTION
I am using istio 1.0.2 version with istio-demo-auth.yaml, I have one mssql and activemq deployed in the same namespaces with other applications, both were be injected by istioctl. The applications can connect to those two services inside the cluster, but I make those two services' type as NodePort, it succeeded, but I cannot access those nodeport(52433, 51618, or 58161).
kubectl get svc -n $namespace
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
amq-master-01 NodePort 10.254.176.151 61618:51618/TCP,8161:58161/TCP 4h
mssql-master NodePort 10.254.209.36 2433:52433/TCP 33m
kubectl get deployment -n $namespace
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
activemq 1 1 1 1 4h
mssql-master 1 1 1 1 44m
Then I try to use gateway and virtualservice for using ingressgateway tcp port 31400. It works, as below:
...ANSWER
Answered 2018-Nov-05 at 16:36Referring to the documentation:
Type NodePortIf you set the type
field to NodePort
, the Kubernetes master will allocate a port from a range specified by --service-node-port-range
flag (default: 30000-32767), and each Node will proxy that port (the same port number on every Node) into your Service
. That port will be reported in your Service
’s .spec.ports[*].nodePort
field.
Just update your config of all masters and you will be able to allocate any port.
Regarding to the second question: I suggest you to create an issue on github, because it looks like a bug, there are no restrictions to use nodePort in the documentation.
QUESTION
I have been searching over the internet and have been trying different ways to make it work but I couldn't get it working.
Actually my system need to connect to multiple tcp server endpoints (which we call payers endpoint) as a tcp client application. The client components include the throttling and queuing components and they get initialized dynamically based on the payers configurations stored in DB as a separate application context. I have created a tcp outbound gateway for this purpose and which is being initialized in a dynamic context based on the ideas given in
https://github.com/spring-projects/spring-integration-samples/tree/master/advanced
What I want is to catch/get exceptions to the calling code at the time calling the payersGateway component in case of any error. But I am unable to receive the exceptions back.
My context file for tcp client connectivity is as follow:
dynamic-tcp-gateway-context file ...ANSWER
Answered 2018-Jun-14 at 19:21It should work as you need; exceptions before the throttlerChannel
will be thrown directly to the caller; exceptions after that channel will be sent to the gateway by the poller's error handler.
Perhaps your gateway timeout is too short?
Turning on DEBUG logging and following the message flow should help you debug it.
EDIT
You can fix the missing failedMessage
by adding a bean of this type to the Tcp outbound gateway's ...
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install tcp-gateway
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page