CAsyncSocket questions
-
Hi, I am still having problems with my TCP/IP connection as I get a timeout notification in my OnConnect overridable I have a few questions 1) do the Socket and Bind Function do the same as Create ? 2) Would using the SetSockOpt SO_KEEPALIVE options help ? 3) could someone give a example of the C++ syntax for using the SOCKET operator in obtaining the socket handle Thanks
-
Hi, I am still having problems with my TCP/IP connection as I get a timeout notification in my OnConnect overridable I have a few questions 1) do the Socket and Bind Function do the same as Create ? 2) Would using the SetSockOpt SO_KEEPALIVE options help ? 3) could someone give a example of the C++ syntax for using the SOCKET operator in obtaining the socket handle Thanks
Provide the code snippet of Client that make connect request and code snippet that listens on a port xyz. With that people can help you.
-
Provide the code snippet of Client that make connect request and code snippet that listens on a port xyz. With that people can help you.
I have 4 CAsyncSocket derived classes wrapped inside 4 Derived CWinThread Class in the CWinThread::Initinstance I set the ipaddr = "192.168.1.4" When I use NULL as the last parameter in the CAsynSocket::create or BIND I am successful in creating a socket however when I use the ipaddr "192.168.1.4" the ipaddr of the machine I get WSAEADDRNOTAVAIL The listening code is MainFrame Assembler EZASMI select which is intended to process multiple I/O's on multiple sockets
EZASMI TYPE=SELECT, Issue Macro MAXSOC=MAXSOC1, SPECIFY MAXIMUM NUMBER OF SOCKETS TIMEOUT=TIMEVAL, RSNDMSK=RSNDMSK, READ MASK RRETMSK=RRETMSK, RETURN FROM READ WSNDMSK=WSNDMSK, WRITE MASK WRETMSK=WRETMSK, RETURN FROM WRITE ESNDMSK=ESNDMSK, ERETMSK=ERETMSK, ERRNO=ERRNO, (Specify ERRNO field) RETCODE=RETCODE, (Specify RETCODE field) ECB=MY\_ECB, MAIN TASK EMB ERROR=ERROR, Abend if Macro error TASK=MYTIE, MF=(E,MY\_PARM)
thisocket.Socket(SOCK_STREAM,FD_READ|FD_WRITE|FD_CONNECT,NULL,AF_INET);
if(thisocket.Bind(thisocket.port,ipaddr) == 0)
error_code = GetLastError();
thisocket.GetSockOpt(SO_KEEPALIVE | SO_DEBUG, &thisocket.option,val_ptr, SOL_SOCKET);
if(thisocket.SetSockOpt(SO_KEEPALIVE | SO_DEBUG, &thisocket.option,val, SOL_SOCKET) == 0)
error_code = GetLastError();