目前,我们从客户端从端口9020接收。该客户端使用端口的末端开关,有时我们会在一个端口上使用多个“已建立”连接 - 全部带有不同的远程端口。我们可以手动结束每个已建立的连接,几秒钟后我们的工作将再次连接。我们还可以为列出的每个远程端口运行EndTCPCNN。我们正在寻找一种方法,以编程方式查看是否有多个远程端口连接到本地端口,如果是这样,则结束已建立的连接(在让侦听器运行时)。有人知道一种获取信息的方法吗?
Currently we receive on port 9020 from a client. That client uses port switching on their end and sometimes we wind up with multiple "Established" connections on the one port - all with different remote ports. We can manually end each established connection and our job will connect again after a few seconds. We can also run ENDTCPCNN for each remote port listed. We are looking for a way to programmatically see if there are multiple remote ports connected to the local port and if so end the established connections (while leaving the Listener running). Does anyone know of a way to get the information?
发布评论
评论(1)
要回答您的问题,假设您是OS的支持版本,请看一下 QSYS2.NETSTAT_INFO SQL视图。
否则,您需要使用和自己。
但是您确定需要这样做吗?听起来客户正在将连接打开以进行重复使用。这是表演的好事。您的服务器代码应自动计时并关闭空闲连接。
To answer your question, assuming you are on a supported version of the OS, take a look at the QSYS2.NETSTAT_INFO SQL view.
Otherwise, you'd need to use the List Network Connections and Retrieve Network Connection Data APIs yourself.
But are you sure you need to do this? Sounds like the client is leaving the connection open for re-use. That's a good thing for performance. You server code should be automatically timing out and closing idle connections.