That previous post was code to connect when using non-blocking sockets.
According to what I have read, you cannot change the blocking mode after
connecting, so before that previous code segment run:

// Set the socket to be non-blocking
flag = true;
NetLibSocketOptionSet (netLibRefnum, netSocketRef, netSocketOptLevelSocket,
netSocketOptSockNonBlocking, &flag, sizeof (flag), netTimeout, &err);
flag = true;
// Turn off Nagle optimizing algorithm
NetLibSocketOptionSet (netLibRefnum, netSocketRef, netSocketOptLevelTCP,
netSocketOptTCPNoDelay, &flag, sizeof (flag), netTimeout, &err);

-Dave


"David Webb" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Here's a cheap an easy way.  Not necessarily proper, but works well.
There
> is a good explanation in Chapter 12 of Greg Winton's book "Palm OS Network
> Programming" on how to do it "properly".
>
>
> netHostInfoP = NetLibGetHostByName (netLibRefnum,
>                                     svrAddress,
>                                     &netHostInfo,
>                                     netTimeout,
>                                     &err);
> if (netHostInfoP && !err)
>     netInfo.netSocketAddr.addr = netHostInfo.address[0];
>
> if (!err) {
>     netSocketAddr.family = netSocketAddrINET;
>     netSocketAddr.port = port;
>     do {
>         result = NetLibSocketConnect (netLibRefnum,
>                                       netSocketRef,
>                                       (NetSocketAddrType*)&netSocketAddr,
>                                       sizeof(netSocketAddr),
>                                       netTimeout,
>                                       &err);
>         SysTaskDelay (SysTicksPerSecond() / 4);
>     } while (err == netErrWouldBlock || err == netErrSocketBusy);
>
>     // Not really errors
>     if (err == netErrSocketAlreadyConnected || err ==
> netErrAlreadyInProgress)
>         err = 0;
> }
>
> -Dave
>
>
>



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to