Home AMX User Forum NetLinx Studio

simultaneous connection help

Hi, Iam'new with IP connections and need some help.

I need some help to monitor and send from a simutaneos server connection.
I have 20 NI700 and want to talk from 1 to al the others.
The 1 is the server and all the other one's are connecting to it,
It is working with 2 ni700 but i don't know how i can filter out the data what iam recieving to the server..\

IP_SERVER_OPEN(dvIPServer.Port,nIPPort,TCP_IP)
IP_SERVER_OPEN(dvIPServer.Port + 1,nIPPort,TCP_IP)

I use this for open 2 connections, but in the recieve String(data.text). i get data from only the first connection.
And how do i send data(sting) to the client from the first connection and the second.
the data i send is to everyone the same and i do send it by using a timeline., but i wil recieve differend data from all.

thanks
Germt

Comments

  • cwpartridgecwpartridge Posts: 120
    There are several ways to do this, but have you considered using a master-to-master setup and defining a virtual device on each system you can talk with? This way, you let the master handle the networking part, simply by setting the URL list appropriately, and then just code your communication using the virtual devices.

    As to your specific question, do you use the same data event for both server sockets? What it seems you're doing you must have two client systems connect, and unless you can ensure that happens you will not be able to relay from one client to the other. And what if all of the clients want to connect at the same time?
  • viningvining Posts: 4,368
    Hi, Iam'new with IP connections and need some help.

    I need some help to monitor and send from a simutaneos server connection.
    I have 20 NI700 and want to talk from 1 to al the others.
    The 1 is the server and all the other one's are connecting to it,
    It is working with 2 ni700 but i don't know how i can filter out the data what iam recieving to the server..\

    IP_SERVER_OPEN(dvIPServer.Port,nIPPort,TCP_IP)
    IP_SERVER_OPEN(dvIPServer.Port + 1,nIPPort,TCP_IP)

    I use this for open 2 connections, but in the recieve String(data.text). i get data from only the first connection.
    And how do i send data(sting) to the client from the first connection and the second.
    the data i send is to everyone the same and i do send it by using a timeline., but i wil recieve differend data from all.

    thanks
    Germt
    since your are opening 2 servers on the same port it's possible only one server will ever handle incoming data. You might consider just opening one server and then open the 2nd when you have a connection on the first. Then close the first when you're done until you get a connection on the 2nd. Open one for listening and then a 2nd when one is busy, then just try to maintain one listening at all times. Add more servers (same port) if needed.

    You could also open a server/port specifically for each outside device you want to receive data from and keep them all open all the time. Then you always know where the data is coming from.

    If you create an array of your servers you can always use get_last in the DATA_EVENT to determine what server is receiving data. You could use DATA.SOURCEIP to determine where the data is coming from or you can just add a string in the data being sent to these servers to indicate where it's coming from.

    Maybe post some more code and someone can give you a little more advice.
Sign In or Register to comment.