"Silent" IP connections?

annuelloannuello Junior MemberPosts: 294
Is there a way to use IP_CLIENT_OPEN() so that successful IP connects (& disconnects) operate in a "silent" mode? As in, when I telnet into my master and issue the "msg on" command, I get several lines reporting to me that my IP connection opened & closed okay. E.g.
Welcome to NetLinx v3.21.354 Copyright AMX Corp. 1999-2006
>msg on
Extended diagnostic information messages turned on.
>(0949642087) Connected Successfully
(0949642088) CIpEvent::OnLine 0:11:12
(0949642592) Exiting TCP Read thread - closing this socket for local port 11
(0949642593) CIpEvent::OffLine 0:11:12
(0949662082) Connected Successfully
(0949662083) CIpEvent::OnLine 0:11:12
(0949662586) Exiting TCP Read thread - closing this socket for local port 11
(0949662587) CIpEvent::OffLine 0:11:12
msg off
Extended diagnostic information messages turned off.
>
My IP code is polling another device every 20 seconds or so. The MSG ON info is great for development & debugging, but once everything is working okay I'd rather set my code to a "silent" mode which only reports problems with the IP connections, not success as well. I'd prefer this change to be dynamic rather than compile time, but would be happy for either solution. With a 20 second poll, you can imagine what a pain it would be trying to debug other devices/code on the master.

I figured there must be a way, since I've also got RMS on the same master and it never appears in my telnet sessions unless my RMS server is down or the RMS module can't make the connection. I presume is uses the i!-ConenctLinxEngineMod.tko to handle the IP connection to the server, so perhaps the magic answer is hiding inside that .tko file.

Roger McLean
Swinburne University

Comments

  • viningvining X Member Posts: 4,353
    I've never used RMS but can only assume it's a maitained IP connection otherwise I would think you would see all the connection messages. What type of device are you polling every 20 seconds? Is it using HTTP protocol?
  • annuelloannuello Junior Member Posts: 294
    Hmmm... Perhaps you are right with RMS (or i!-ConnectLinxEngineMod) using a maintained connection. Perhaps someone at AMX can confirm that.

    The device is an application running on a PC, and I'm using HTTP to connect to it. As such, I can't really see how I can hold the connection open to the device since at the end of an HTTP transaction you are supposed to disconnect.
  • viningvining X Member Posts: 4,353
    Yeah, HTTP will drop the connection automatically even with "KEEP_ALIVE" or "PERSISTANT" called in the GET command. Does it have to update/check or poll every 20 seconds? Could it be longer?
  • annuelloannuello Junior Member Posts: 294
    Unfortunately, a poll period longer than 20 seconds would be unacceptable. I'm quite happy with the ability to poll devices via IP. I was just looking for a way to silence the usual "okay" case. If it doesn't exist, I suppose I will just have to continue to ignore the online/offline messages when using telnet.
  • alvinyowalvinyow Junior Member Posts: 27
    Help

    Did you ever comes across Connection Refuse?
    I always meet up with

    IPSocketManConnectTask - Connection Refuse problem... why this thing happen?

    This is the most severe problem once it encounter during runtime. You cannot do anything until reset the master controller. How could we overcome this issue? Is there a way to force open the port?
    I'm using IP connection for most of the device i had when there is network port available. Even the kramer switcher....comes with Lanport serial convertor meet the same problem.

    I had tried to open the port without closing it, however it still fail at certain time during runtime. Once the port fail to open or connection refuse. The only solution is the reset the switcher or the master controller.

    Soon i had got the idea from a programmer to do Timeline event. By open and closing it at certain interval. This idea seems work. Yet this does not get rid of the problem. By introducing a timeline to open and closing the port seems engage higher chances to fail in the connection.

    Anyone with a good suggestion to overcome this problem.
  • DHawthorneDHawthorne Junior Member Posts: 4,584
    There is a definite issue in the IP libraries that AMX uses where the online and offline events are not quite synced with whether the port is fully connected or disconnected. You have to wait a good 10 seconds after an offline event, for example, before attempting to re-open the same port, or you will get a "port in use" error. My guess is there is still some housekeeping to be done after the disconnect before the port is actually ready to be used again.
  • alvinyowalvinyow Junior Member Posts: 27
    But this willl be a great problem to the user.....
    Most of the system installed are for the goverment meeting and boardroom...
    10 second of disconnected line was real bad.....and it reli jeopardise the image of the product.
    As they highly regards it as one of the most reliable....piece of equipment....
    No down time is expected. Maybe there is a way to overcome the re-connection issue.
    Regards
    Alvin
  • viningvining X Member Posts: 4,353
    alvinyow wrote:
    Did you ever comes across Connection Refuse?
    I always meet up with

    IPSocketManConnectTask - Connection Refuse problem... why this thing h
    I had this happen today as a matter of fact. I have two 8 port MOXA Serial Severs on a job that handle all the serial ports I need to communicate with besides the 7 the master can handle plus a couple comm 2's. I was trying to set up comms w/ the first server but put in the IP address of the second server whose ports weren't configured in the same range. In short I was trying to open comms on the 1st server port 4661 but actually was connecting to the 2nd server whose ports were set default at 4001-4008. Major brain fart!

    Check your set up an make sure your IP and ports are correct.

    alvinyow wrote:
    I had tried to open the port without closing it, however it still fail at certain time during runtime. Once the port fail to open or connection refuse. The only solution is the reset the switcher or the master controller.

    Soon i had got the idea from a programmer to do Timeline event. By open and closing it at certain interval. This idea seems work. Yet this does not get rid of the problem. By introducing a timeline to open and closing the port seems engage higher chances to fail in the connection.
    I'm not sure if yor're talking HTTP but if it's HTTP open the connection and send your GET, use a variable in your ONLINE & OFFLINE & ONERROR event handlers to track whether you're on or off line. If you need to send more requests use the variable to determine the timing.

    if(!nIPDev_Online && nOtherRequestPending)
    {
    //send next request
    }

    If it's not HTTP most devices can maintain the connection indefinitely and you only need to put a re-connect function call in the offline handler to re-connect you should the connection drop.
  • fogled@mizzou[email protected] h4x354x0r Posts: 549
    I've been doing a lot more IP-based communications as of late, and have noted a couple things:

    On a simple IP_CLIENT connection that does a GET to log some stuff to a database via a PHP application, the online/offline trap I set up to chew through and send buffer data worked flawlessly for almost a month, logging almost 2000 events in that time. Then, one day, one or both of the "variable = 1" statements in the Offline event failed to trigger, and the logging stopped. All I had to do to get it going again (and flush the buffer which was full and holding the last 30 or so events), was go into debug and change one of the two variable values. It's been running fine again for 3 more days now. And now that I'm posting about it, I've just realized that I'm not trapping and handling the possibility that the PHP server is not responding. I think I just solved that one.

    On a fairly complex IP_SERVER setup that acts as a gateway to a PHP-based web interface, I've found that the controller is just too slow to respond to more than one connection per web page load. I would much rather be able to put the results of 2 different calls to the controller on one web page, but the 2nd call invariably fails. (And here I thought using Filemaker as a back-end to a PHP-based web app was slow!) With an NI-3100 controller data is usually returned and the connection is closed in well under a second, but it takes 2-3 seconds before I can get another connection. Of course there's a chance this could be due to poor programming, but it sounds just like what dhawthorne mentioned.

    One other note, for IP_CLIENT connections, I've programmed a Proof-of-concept round-robin pool of IP connections that can be used. I defined 4 IP devices, put them in an array, and then used a 4-character buffer and GET_BUFFER_STRING to grab the index of the first available IP device from the buffer. When the OFFLINE event happens, it puts it's index number back into the buffer, at the end. With a pool of IP devices, you can make some pretty rapid IP transactions. It might be a good workaround to the problem dhawthorne noted. I haven't put it into production yet, but I might try something similar for my IP_SERVER problem stated above.

    The chattiness of the connections doesn't bother me. There are lots of good tools out there for log parsing and analysis.
  • alvinyowalvinyow Junior Member Posts: 27
    vining wrote: »
    alvinyow wrote:

    I had this happen today as a matter of fact. I have two 8 port MOXA Serial Severs on a job that handle all the serial ports I need to communicate with besides the 7 the master can handle plus a couple comm 2's. I was trying to set up comms w/ the first server but put in the IP address of the second server whose ports weren't configured in the same range. In short I was trying to open comms on the 1st server port 4661 but actually was connecting to the 2nd server whose ports were set default at 4001-4008. Major brain fart!

    I'm using serial convertor too. I had 4 pieces of two port serial-ip convertor. So I'm expanding the serial port to total 9 port while i'm using NI900 as the master controller.

    Check your set up an make sure your IP and ports are correct.

    All the port are correctly configure and set at the right port 100 and 101. Since i'm using 4 serial devices. So i need to define 4 diff IP for each device. The port is factory set at 100 for port 1 and 101 for port 2.



    alvinyow wrote:

    I'm not sure if yor're talking HTTP but if it's HTTP open the connection and send your GET, use a variable in your ONLINE & OFFLINE & ONERROR event handlers to track whether you're on or off line. If you need to send more requests use the variable to determine the timing.

    I'm not using HTTP. I used to check the status of the device in ONLINE & OFFLINE & ONERROR event handler. Last year i use this technique to poll the status.....and the re-connection problem still the real issue.
    Currently, I'm using timeline to do open and closing port at certain interval. The process seems work and today i had not meet any re-connection issue. Maybe because i reboot the master so many times during programming the master. So the problem did not surface.

    if(!nIPDev_Online && nOtherRequestPending)
    {
    //send next request
    }

    If it's not HTTP most devices can maintain the connection indefinitely and you only need to put a re-connect function call in the offline handler to re-connect you should the connection drop.

    You mean just do an open port cmd and use the ONLINE & OFFLINE & ONERROR event handler to maintain the reconnection?
  • viningvining X Member Posts: 4,353
    alvinyow wrote:
    You mean just do an open port cmd and use the ONLINE & OFFLINE & ONERROR event handler to maintain the reconnection?
    If we're talking HTTP then yeah, open a connection when you trigger the online event send your first request (GET or POST) and set your var to 1. The server will respond to your request and send some sort of a response and close the connection. This will trigger and off_line event where you set your var to 0. Now that your var is 0 if you have more traffic to send do another IP_CLIENT_OPEN and when your get the online event from that send your next request........and so on...
Sign In or Register to comment.