TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Thomas Seeling
date: 1996-04-09 15:48:38
subject: tcp/ip gethostbyaddr() multithread

Hallo, All!


Does anybody know of any problems when using gethostbyaddr() of TCP/IP 2.0
(un64092) in multithreaded programs?

The programmer's reference says that the call returns a pointer to static
data; this might cause problems when multiple calls from different threads
come in very quickly (500+ threads).

The application is a mt www server, and I want to provide the remote host
name to CGI scripts. As soon as I compile the code with ghba() it crashes
when doing that call, but only in multithreaded mode.

I tried to protect this call with a mutex semaphore, but it didn't work
either (and of course I don't want this kind of solution, since this would
be a heavy bottleneck).

Is ghba() threadsafe, do I have another bug in my program, is there another
way to determine the foreign host name besides that specific call?

A preview version of the server can be downloaded from my www page at
http://www.uni-giessen.de/~g087/os2.html.

When the host dw1.hrz.uni-giessen.de (134.176.3.53) is up and responds to
requests on port 80, it is running my server :-)


Tschau...Thomas

--- E3-32/1.11-32/2.50+
* Origin: Die TeX-Box +49-6034-1455 V.34 -930022 ISDN 24h (2:244/1130.42)
SEEN-BY: 50/99 78/0 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 244/1130 24/999 2/777 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.