home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.protocols.tcp-ip:5096 comp.unix.wizards:4571
- Path: sparky!uunet!cs.utexas.edu!ut-emx!tivoli!paul
- From: paul@tivoli.UUCP (Paul Greenspan)
- Newsgroups: comp.protocols.tcp-ip,comp.unix.wizards
- Subject: TLI and non-blocking I/O
- Keywords: TLI, SVR4, non_blocking
- Message-ID: <5853@tivoli.UUCP>
- Date: 7 Nov 92 17:19:03 GMT
- Reply-To: paul@tivoli.com (Paul Greenspan)
- Followup-To: comp.protocols.tcp-ip
- Organization: TIVOLI Systems
- Lines: 63
-
- Below is a description of a problem that we are having with some of
- our network code. I would appreciate any help that I could get.
-
- Background:
- -----------
- We have taken a rather complicated server that was developed with BSD
- sockets and converted it to use TLI. The server has to handle many
- things at once (with threads) so it is important that we use non-blocking
- endpoints. So to avoid blocking on a t_listen() call waiting
- for a connection request, we wait for poll() to tell us that
- there is a connection request and then try to call t_listen().
-
- Here is a description of the behavior of some of our TLI code, as
- executed under SVR4.0.3:
-
- [SERVER]
- 1. The server calls t_open(DEV_TCP, O_RDWR, 0).
- 2. The server calls ioctl(tfd, FIONBIO, &non_blocking)
- to set the TLI endpoint into non-blocking mode.
- 3. The server calls t_bind(tfd, &req, &ret) to offer
- a channel to clients. The bound address is selected
- by the transport provider (req.addr.len is 0) and
- gets recorded so clients can be told on what address
- to t_connect.
- 4. The server calls poll() to wait for connection requests.
-
- [CLIENT]
- 5. A client initiates a connection request by first
- calling t_open(DEV_TCP, O_RDWR, 0).
- 6. The client then calls t_bind(tfd, 0, 0)
- 7. The client calls t_connect(tfd, connreq, 0), where
- connreq has been t_alloc'd, then set up with the
- correct address, no options, and no user data.
-
- NOTE: The client's t_connect will later appear to
- succeed. (Weird.)
-
- [SERVER]
- 8. The server is notified of the connection request
- by poll(). t_look(tfd) returns T_LISTEN (1).
- 9. The server calls t_listen(tfd, callptr), where
- callptr has been t_alloc'd but otherwise left alone.
- This call fails, returning -1. t_errno is
- TNOTSUPPORT (18).
-
- [CLIENT]
- 5. A client initiates a connection request by first
- calling t_open(DEV_TCP, O_RDWR, 0).
- 10. Here's the weird part. The client's t_connect
- call now returns and indicates all is well.
- So the client code keeps going.
- 11. The client calls ioctl(tfd, I_POP, 0)
- 12. The client calls ioctl(tfd, I_PUSH, "tirdwr")
- 13. The client calls write(tfd, buf, sizeof(u_long)).
- This succeeds!
- 14. The client calls read(tfd, buf, sizeof(u_long)).
- This is where the client finally sees something
- is wrong, as the read call returns 0.
-
- --
- Paul Greenspan paul@tivoli.com
- Tivoli Systems 6034 West Courtyard, Suite 210
- Austin, Texas 78730 (512) 794-9070 / FAX (512) 794-0623
-