Home AMX User Forum AMXForums Archive Threads AMX Hardware

NI-700 ? UDP input buffer bug?

I have an application that is running on an NI-700 and it has a port open to listen for UDP messages. Whenever I broadcast a UDP message (from a PC) to the NI-700 everything over 256 bytes (from one message) is lost. If I change the protocol from UDP to TCP on the NI-700 and the PC application, then data over 256 bytes does not get lost and all the data gets buffered correctly. I don?t believe it?s any sort of UDP limitation because I broadcast UPD messages all the time in the PC world that are over 256 bytes in length.

Is there a UDP input buffer bug for the N-I700? (I hoping it?s only a bug and not an imposed limitation) The firmware off the master is the latest and greatest (v2.95.214.)

I haven?t tried this on the NI-2000, 3000 or 4000.

Thanks,
Joe

Comments

  • Joe HebertJoe Hebert Posts: 2,159
    Hi it?s me again. Below is sample code that verifies the 256 byte UDP input buffer limit. It?s just a simple loopback test where a 1K message gets sent as both UDP and TCP when button #1 is pushed. If you load the code and watch cUDPBuffer and cTCPBuffer, you will see every time button #1 is pushed the length of cUDPBuffer increments by 256 bytes and cTCPBuffer will increment by the entire 1024 bytes.

    While I was testing I also found that there is a 2012 byte TCP input buffer limit. This is confirmed by pushing button #2 which sends out a 2K message as both UDP and TCP. Again cUDPBuffer will increment by 256 bytes and cTCPBuffer will only increment by 2012 and not the expected(?) 2048.

    The last entry in TN156 shows that the Ethernet input buffer length of the NXC-ME is 16000 bytes (at least that?s what I think it?s saying) Does that mean I should be able to buffer 16000 byte TCP or UDP messages?

    Anyhow, I don?t know if the limitations I?m running across with the NI-700 are the same as the rest of the NI series. Would anyone care to try this code on an NI-700 or greater and confirm this?

    Thanks in advance,
    Joe

    Here?s the code:
    (***************************************)
    DEFINE_DEVICE
    
    dvUDPClient	= 0:3:0
    dvUDPServer	= 0:4:0
    dvTCPClient	= 0:5:0
    dvTCPServer	= 0:6:0
    dvTP		= 10001:1:0
    
    (***************************************)
    DEFINE_CONSTANT
    
    INTEGER nTCP = 1
    INTEGER nUDP = 2
    
    INTEGER nUDPPort = 2000
    INTEGER nTCPPort = 2001
    
    (***************************************)
    DEFINE_VARIABLE
    
    CHAR cUDPBuffer[10240]
    CHAR cTCPBuffer[10240]
    
    CHAR c1KMessage[1024]
    CHAR c2KMessage[2048]
    
    IP_ADDRESS_STRUCT sNetlinx
    
    (***************************************)
    DEFINE_START
    
    CREATE_BUFFER dvUDPServer, cUDPBuffer
    CREATE_BUFFER dvTCPServer, cTCPBuffer
    
    GET_IP_ADDRESS(0:0:0,sNetlinx)
    
    IP_SERVER_OPEN(dvUDPServer.Port,nUDPPort,nUDP)
    IP_CLIENT_OPEN(dvUDPClient.Port,sNetlinx.IPAddress,nUDPPort,nUDP)
    
    IP_SERVER_OPEN(dvTCPServer.Port,nTCPPort,nTCP)
    IP_CLIENT_OPEN(dvTCPClient.Port,sNetlinx.IPAddress,nTCPPort,nTCP)
    
    SET_LENGTH_ARRAY (c1KMessage,1024)
    SET_LENGTH_ARRAY (c2KMessage,2048)
    
    (***************************************)
    DEFINE_EVENT
    
    BUTTON_EVENT[dvTP,1] {
       PUSH: {
          SEND_STRING dvUDPClient, c1KMessage
          SEND_STRING dvTCPClient, c1KMessage
       }
    }
    
    BUTTON_EVENT[dvTP,2] {
       PUSH: {
          SEND_STRING dvUDPClient, c2KMessage
          SEND_STRING dvTCPClient, c2KMessage
       }
    }
    
    BUTTON_EVENT[dvTP,3] {
       PUSH: {
          CLEAR_BUFFER cUDPBuffer
          CLEAR_BUFFER cTCPBuffer
       }
    }
    (***************THE END****************)
    
  • Joe HebertJoe Hebert Posts: 2,159
    Sorry to bump up such an old thread, especially since I?m the only one in here but I?d like to tie up loose ends. The issues listed above have been addressed. I don?t know what firmware rev fixed them but I do know it?s fixed for the latest DUET NI-700 (3.12.335) :)
  • Spire_JeffSpire_Jeff Posts: 1,917
    Thanks for the update Joe. Never know when I'll need to use UDP and this find could very well have saved me hours of hair pulling :)

    Jeff
  • I am opening this yet again. Sorry.
    Not sure if it falls under the same trouble ticket, but I seem to have my Multicast strings truncated after 2048 chars. Anybody able to listen to a UDP server using "IP_MC_SERVER_OPEN" and retrieve strings exceeding 2048 bytes?

    >>> Using NI200, fw 3.05.430
Sign In or Register to comment.