fix: remove unnecessary getaddrinfo and gethostbyname

This commit is contained in:
uhi22 2023-08-07 04:18:31 +02:00
parent 7ba7bedd23
commit 7f13c3f5cf

View file

@ -168,15 +168,7 @@ class pyPlcTcpServerSocket():
self.callbackStateNotification(1) # inform the higher level state machines, that TCP is listening self.callbackStateNotification(1) # inform the higher level state machines, that TCP is listening
self.addToTrace("pyPlcTcpSocket listening on port " + str(self.tcpPort)) self.addToTrace("pyPlcTcpSocket listening on port " + str(self.tcpPort))
hostname=socket.gethostname() hostname=socket.gethostname()
self.addToTrace(hostname) self.addToTrace("Hostname is " + hostname)
IPAddr=socket.gethostbyname(hostname)
addressInfo = socket.getaddrinfo(hostname, None, socket.AF_INET6)
#print("Your Computer Name is:"+hostname)
self.addToTrace("The socket is linked the following IP addresses:")
for i in range(0, len(addressInfo)):
#fe80::4c46:fea5:b6c9:25a9
IPv6Addr = addressInfo[i][4][0]
self.addToTrace(IPv6Addr)
self.read_list = [self.ourSocket] self.read_list = [self.ourSocket]
self.rxData = [] self.rxData = []