Re: Non blocking mode of socket connection doesn't work
- From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
- Date: Tue, 26 Feb 2008 08:42:43 -0700
Who knows. I presume that the socket resulting from accept() is probably
set, by the WinSock stack on your desktop machine, to the same options as
the socket on which the accept() call was made (I'd say that the desktop is
broken, not the Windows CE device, if that's the case). Setting the
blocking option to match the parent socket is not documented as correct
behavior, so, as with any non-specified thing, every WinSock provider can do
whatever they want.
Paul T.
"Bernie" <indico(at)gmx-topmail.de> wrote in message
news:47c3b2b9$1_7@xxxxxxxxxxxxxxxxxx
Thank you very much. Now it works fine. The only thing what I don't
understand is the difference between Win XP and Win CE. Why it has worked
on the desktop pc with only one call to ioctlsocket() after the bind()?
Bernie
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> schrieb im Newsbeitrag news:udKZza8dIHA.748@xxxxxxxxxxxxxxxxxxxxxxx
You would not be calling recv() on the same socket identifier as you call
accept() on! Accept() returns another socket, the connected socket with
which you will communicate. You'll have to set its options separately
from the socket on which you call accept(). Something roughly like this:
-----
server = socket() - create the server socket to which clients will
connect
ioctlsocket() - change blocking mode for server socket
bind() - define which port number clients will connect to, etc.
listen() - define how many waiting clients will be allowed
connected = accept() - get the next connecting client and give us a
connected socket with which to communicate to him
ioctlsocket() - change blocking mode for connected socket
recv()
-----
Paul T.
"Bernie" <indico(at)gmx-topmail.de> wrote in message
news:47c26aa2$1_5@xxxxxxxxxxxxxxxxxx
Thanks for your answer. The ioctl return correct and also the accept
works in non blocking mode. Only the call to recv is blocking. The
socket is createt with
socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
Bernie
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> schrieb im Newsbeitrag
news:OWhLcUKdIHA.5160@xxxxxxxxxxxxxxxxxxxxxxx
It does work in general. Did your ioctl succeed? You might check the
type of u_long and make sure that it's a 32-bit integer. Are you
setting the non-blocking bit for the right socket, oSocket? This is a
regular network stream socket, right?
Paul T.
"Bernie" <indico(at)gmx-topmail.de> wrote in message
news:47bd8cb4_6@xxxxxxxxxxxxxxxxxx
Hi
On a Win CE 5.0 device (SDK Trizeps IV) I have a server which is
listening on a TCP port for incomming calls. I have set the connection
to non blocking mode with the function "ioctlsocket":
u_long ulArg = 1;
ioctlsocket(oSocket, FIONBIO, &ulArg);
When I run the program on a Desktop PC the socket function "recv"
isn't waiting for incomming characters. But when I run the same
program on the Win CE device, the "recv" is blocking.
Is the feature of non blocking mode not supported by Win CE 5.0? Or is
another way possible to set the socket on non blocking mode? Or is
something wrong in the command above?
Thanks and regards
Bernie
.
- References:
- Non blocking mode of socket connection doesn't work
- From: Bernie
- Re: Non blocking mode of socket connection doesn't work
- From: Paul G. Tobey [eMVP]
- Re: Non blocking mode of socket connection doesn't work
- From: Bernie
- Re: Non blocking mode of socket connection doesn't work
- From: Paul G. Tobey [eMVP]
- Re: Non blocking mode of socket connection doesn't work
- From: Bernie
- Non blocking mode of socket connection doesn't work
- Prev by Date: Re: Testing simple apps using the Sample CE Device
- Next by Date: Re: Developing Wince 5.0 Console Application using eVC++
- Previous by thread: Re: Non blocking mode of socket connection doesn't work
- Next by thread: Debug messages for wince application
- Index(es):
Relevant Pages
|