Processes operating as socket servers can only serve one process at a time, regardless of which OS or DBMS platform creates the socket. SO$REUSEADDR is intended to eliminate the TIME_WAIT state if the process running the listener happens to die. If there is no step in U2 between init and accept then if the process dies you'll just have to accept the fact that you can't use the socket until the handle is released.
This is one of the unfortunate issues of using sockets from MV. Part of the problem is that the MV DBMS is an application over the OS, and the handle to the socket is only released if the MV monitor explicitly releases it. If you whack an MV process without allowing it to go through a proper wrapup, then the host OS doesn't know that the socket should be available, so SO$REUSEADDR is useless anyway. In the case of D3, the only way to release a socket that's been whacked like this is to reboot D3 itself - a major pain to get all users off the system to release a single socket - and for this reason I discourage use of D3 as a socket server. I'd be interested to know if U2 is any more adept at handling this scenario. I guess it comes down to the definition of the word "whacked" and how well U2 handles such conditions. I don't do U2 sockets but I'm guessing Craig's code is missing something. In socket comms, you wait on the listen, accept a connection, do whatever you need, then go back to listen. Looping on accept is OK but after the repeat you have to go back to listening, and that shouldn't mean going back to the initServerSocket unless an existing socket goes immediately to listen. Tony TG@ removethisNebula-RnD .com Craig Bennett wrote: > It looks to me like you are using SO$REUSEADDR to allow > multiple processes to share the same address/port. As far > as I am aware this will not work under U2 because the > setSocketOptions can only be called after > initServerSocket which includes the bind and listen > operations (I recall this from a post be Ken Wallis a few > years back, so I could be wrong or U2 could have > changed). > > Because of this, in U2 I think you would: > > loop > err = accepConnection(sock, timeout, client.addr, > client.name, client.sock) > while 1 do > > repeat > > since one process must server all your socket requests > one by one. ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/