bind, connect, etc. and nonblocking mode
bind, connect, etc. and nonblocking mode
- Subject: bind, connect, etc. and nonblocking mode
- From: Zack Morris <email@hidden>
- Date: Mon, 25 Mar 2002 14:13:57 -0700
Hi, I am almost done with my sockets library for classic Mac OS, which I
modeled after the sockets interface for OS X. I had to write the UDP
portion using asynch/blocking so I could mark down the timestamp on incoming
packets (then queue packets internally), but the TCP portion (half done
right now) uses synch/nonblocking with synch idle. The library is going to
be used mainly as synch/nonblocking and select.
I am just wondering about edge cases for functions other than sending
and receiving. For instance, say I bind an endpoint/socket. For UDP, I
will get a T_BINDCOMPLETE in the notifier, and the routine should return
kOTNoError. What do I do in the meantime? Do I have the socket's bind()
routine return 0? The problem is that there is a small chance that it will
still be unbound when I try to send, so it might give me a TOUTSTATE error
if I try to call sendto() (OTSndUData() internally). I think there is a way
to set a flag from my notifier so that my select() will notice it and mark
that socket as useable. Otherwise, can I look at the state somehow and have
sendto() return an error if the endpoint is not bound yet?
I have a host of similar edge cases for connect, accept, etc. I have
read the man pages for them, but they are just not clear about exactly what
results are returned for nonblocking sockets, and how to find out if an
action has completed. I obviously can't reproduce every case by pulling out
my ethernet cable or modem, ha ha. Thank you for any insights,
Zack Morris
Z Sculpt Entertainment
email@hidden
http://www.zsculpt.com
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.