home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.programmer
- Path: sparky!uunet!walter!porthos!delphinus!chw
- From: chw@bellcore.com (Charlie Woloszynski)
- Subject: DGram sockets (UDP) and select on SunOS 4.1
- Reply-To: chw@bellcore.com
- Organization: Bellcore
- Date: Thu, 7 Jan 93 18:24:10 GMT
- Message-ID: <1993Jan7.182410.21332@porthos.cc.bellcore.com>
- Sender: netnews@porthos.cc.bellcore.com (USENET System Software)
- Lines: 49
-
- From chw Thu Jan 7 13:15:44 1993
- To: jroberts@east.sun.com
- Subject: Socket question
-
-
- I am trying to use a socket (dgram, udp) between two processes and
- I'm having some difficulty with select(). Select returns immediately,
- telling me that the socket is ready for reading. But, when I read
- it, the recv() blocks until the second process actually sends some data.
- Is this "normal" for datagram sockets and select?
-
- Here is some more of the details: I have two processes. Each creates
- a socket () (dgram, udp), bind()s it to a unique port, and connect()s to
- the remote address (host, port). Since these are dgram sockets, this
- connect only set the remote address to use and receive from. No real
- connection is established. Anyway, I assume that this lets the
- kernel filter incoming datagrams to the appropriate socket this way.
- No errors are indicated by the
- return value, but the errno goes from 0 to EACCES (permission denied).
- The man page indicates this error is only for UNIX domain addresses,
- but I have used PF_INET exclusively for addressing. The sockets I am
- using are not in /etc/services or any other system file I can think
- to look into. Should they be (for dgram)? If I
- add them, is there any processes that need to be restarted to recognize this
- change?
-
- Now the first select call I do immediately returns (before the second
- process send to it). So, my code does a recv() which now blocks until
- the second process sends something. This characteristic repeats itself
- endlessly (well, as long as my patience lasted, about three minutes
- while I stewed and thought of other tests!!)
-
- I also tried putting the socket into non-blocking mode, in which case
- the recv() would return immediately (with errno=EWOULDBLOCK) and
- then select would immediately indicate the socket was ready for input.
-
- Any help would be greatly appreciated.
-
- Charlie Woloszynski
- -----------------------------------------------------------------------------
- Charlie Woloszynski MTS - ATM Technology and Applications
- Bellcore +01 201 829 5228 (voice)
- Room MRE 2J-294 +01 201 829 5887 (fax)
- 445 South Street Box 1910 chw@bellcore.com (SMTP)
- Morristown, NJ 07960-1910 USA
- -----------------------------------------------------------------------------
-
-
-
-