Force packetise and interesting phenomena with two listening sockets
Force packetise and interesting phenomena with two listening sockets
- Subject: Force packetise and interesting phenomena with two listening sockets
- From: Liwei <email@hidden>
- Date: Thu, 16 Oct 2008 07:27:44 +0800
[Sorry if I missed something obvious, coding way past my sleeping hours]
I wonder how I can force my data to be sent with as a single packet
under TCP with each call to either send() or CFWriteStreamWrite()
instead of bunching them up into multiple big packets. It seems to be
able to do that under UDP but not TCP.
Rephrase in case I'm not making sense:
How can I make sure that send() and CFWriteStreamWrite() sends one
packet per call?
The other problem is that I have two listening TCP sockets, one that
is purely for sending data, the other for receiving data. The
interesting thing is that when the sending side accepts a connection
before the receiving side, everything works properly, however if the
receiving side is connected first, select() on write returns with the
fd_set for write set to false and causes my application to not send
anything. I don't have the energy to test if the socket is really
blocked at the moment, but I believe what select() says.
Background on how the sockets are done, arguments in brackets are just
the interesting stuff, general idea, meaning I didn't actually try to
set the constant kCFSocketAutomaticallyReenableAcceptCallBack to
false:
CFSocketCreate() -> bind(INADDR_ANY) -> listen(1) ->
kCFSocketAutomaticallyReenableAcceptCallBack=false ->
kCFSocketAcceptCallBack -> CFSocketCreateWithNative(accepted_socket)
Both connections to the application are from two separate computers,
e.g. Computer1 connects to the write socket, Computer2 connects to the
read socket. I've also done both connections from each computer and on
the loopback interface as well, same results.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden