I used it in the way you mentioned i.e. after opening the socket and before
connecting but after doing this i am not able to connect to the server.
I i removes NetLibSocketOptionsSet() function , then there is no problem in
connection.
This is what i am doing :
UInt8 rcvbuf[16];
Err rc, rc2;
UInt16 appNetRef, appSocketRef;
UInt16 ifErrs;
NetSocketAddrINType destAddr;
NetIPAddr addr;
Err result;
Boolean flag=true;
*netRef = NULL; // Clear return parameters.
*socketRef = NULL;
rc = SysLibFind("Net.lib", &appNetRef); // Find system network
library.
if (rc == errNone) {
addr = NetLibAddrAToIN(appNetRef,"IP ADDRESS");
rc = NetLibOpen(appNetRef, &ifErrs); // Open system network
library.
if ((rc == errNone) && (ifErrs != errNone)) rc = ifErrs;
if ((rc == errNone) || (rc == netErrAlreadyOpen)) {
// Open a socket
appSocketRef = NetLibSocketOpen(appNetRef, // Network
library
netSocketAddrINET, // Address
domain
netSocketTypeStream, // Socket type
netSocketProtoIPTCP, // Protocol
300, // Timeout - 3
seconds
&rc); // Error result
if (rc == errNone) {
/// Setting the option
NetLibSocketOptionSet(appNetRef, appSocketRef,
netSocketOptLevelSocket,netSocketOptSockNonBlocking,&flag, sizeof(flag), 0,
&result);
// Connect the socket to its destination
MemSet(&destAddr, sizeof(destAddr), 0);
destAddr.family = netSocketAddrINET;
destAddr.port = 33665;
destAddr.addr = NetLibAddrAToIN(appNetRef,"IP ADDRESS");
rc = NetLibSocketConnect(appNetRef,
appSocketRef,
(NetSocketAddrType*)&destAddr, //
Destination address
sizeof(destAddr), //
Length of destAddr
500, //
Timeout - 5 seconds
&rc); //
Error result
if (rc == errNone) {
rc2 = NetLibReceive(appNetRef, // Network library
appSocketRef,// Socket reference
rcvbuf, // Buffer to receive data into.
8, // Max number of bytes to
receive.
0, // Flags
NULL, // Destination address -- does
not apply to TCP sockets
0, // Length of destination address
300, // Timeout - 3 seconds.
&rc); // Error result
}
I absolutely dont know why its happening
Durgesh Trivedi <[EMAIL PROTECTED]> wrote:
Err SocketSetupNonBlocking()
{
Err result;
Boolean flag=true;
return(NetLibSocketOptionSet(AppNetRefnum, socket,
netSocketOptLevelSocket,netSocketOptSockNonBlocking,&flag, sizeof(flag), 0,
&result));
}
Try it like this and u set the socket before connection and after the opening
its works well ....
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/
---------------------------------
The fish are biting.
Get more visitors on your site using Yahoo! Search Marketing.
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/