Poco StreamSocket segfault

StreamSocket class within Poco 1.4.2p1 library is not thread safe when used under Linux, because gethostbyname() is not thread-safe under Linux. For instance, if a client like

client.cpp
is used to make several connections, a segmentation fault can occur:
trace
Debug session for the DNS.cpp shows that there is no alias addresses:
debug
When threads are switched, null string is stored within HostEntry::HostEntry(struct hostent* entry). This causes the segmentation fault shown above.

FreeBSD does not suffer of this issue.

ready.

10 print "mail: contact at alepho.com | skype: karastojko | stackoverflow: karastojko | github: karastojko"
20 print "(c) 2009-2023 www.alepho.com"