LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCPListen Connection Poblem

Python 3.6

import socket
 
def Main():
    host = ''
    port = 49157
     
    mySocket = socket.socket()
    mySocket.bind((host,port))
     
    mySocket.listen(1)
    conn, addr = mySocket.accept()
    print ("Connection from: " + str(addr))
    while True:
            data = conn.recv(300)
            if not data:
                    break
            print ("Data: " + str(data))

    conn.close()
     
if __name__ == '__main__':
    Main()

 

0 Kudos
Message 11 of 12
(448 Views)

The solution was to set the input "resolve remote address" of the TCP  Wait on Listener to false. Default it is true and it asks after the name of the ip out of the dns, but when there is no name, after 4-5s it gets out an LabVIEW gets the connection id and can read it.

With false on resolve remote addres TCP Listen doesnt want to read the name of the ip and i get a fast connection.

0 Kudos
Message 12 of 12
(371 Views)