Home AMX User Forum NetLinx Studio

IP Server Question

Greetings,

I am working on an Netlinx IP communication project.

In my code I am opening an IP server to listen for a client. The client is able to connect and send messages.

The problem that I am having is that when the client goes offline, it cannot reconnect to the server until the server is rebooted. Internal diagnostics indicate that the connection is closed when the client goes offline.

Must the server then be closed and re-opened?

Thanks.

Comments

  • AMXJeffAMXJeff Posts: 450
    Must the server then be closed and re-opened?

    Closed no! Opened Yes, normally do a IP_SERVER_OPEN on the OFFLINE handler on the Data_Event of that Socket Server.
    DATA_EVENT[dvServer]
    {
        OFFLINE:
        {
           IP_SERVER_OPEN(dvServer.Port,IP_PORT,IP_TCP);
        }
    }
    
    
  • JohnMichnrJohnMichnr Posts: 279
    I had a system recently where I was getting errors as the client kept trying to connect to the server before it came back online. I was using the IP_SERVER_OPEN command in the offline event but it was still too slow...

    I ended up with 4 servers and an array in the data event. As any one server went offline and was re-opened, there was always another server (three more) availabel to the client.

    In the Diagnostics for this program, the servers would just cycle through, 1,2,3,4,1,2,3,4 each one opening a connection then closing it and the next one openeing the conenction.
  • TurnipTruckTurnipTruck Posts: 1,485
    JohnMichnr wrote: »

    I ended up with 4 servers and an array in the data event. As any one server went offline and was re-opened, there was always another server (three more) availabel to the client.

    In the Diagnostics for this program, the servers would just cycle through, 1,2,3,4,1,2,3,4 each one opening a connection then closing it and the next one openeing the conenction.

    That is exactly what I ended up with. I don't know why it cycles though my three available servers, but it works now for the purpose intended.

    Thanks.
Sign In or Register to comment.