minifiredragon
Programmer
The program I have built works about 95% of the time without crashing. I have placed error codes on the OnConnect, OnRecieve, OnSend and OnAccept and there are no errors. It appears the problem occurs between:
m_strCardNumber = dlgInsertCard.m_strCardNumber;
if (m_strCardNumber != "0"
{//2
m_strCardNumber = "1" + m_strCardNumber;
//start code for socket
//create a default socket
m_sConnectSocket.Create();
//open connection to server
//////Problem between here -->
m_sConnectSocket.Connect(m_strIpAddy, m_iPort);
//send Card number
int iLen;
int iSent;
iLen = m_strCardNumber.GetLength();
///// and here -->
iSent = m_sConnectSocket.Send(LPCTSTR(m_strCardNumber), iLen);
//check for errors
if (iSent == SOCKET_ERROR)
When debugging I get this error message:
Unhandled exception at 0x7c2f09c5 (mfc71d.dll) in ICServer.exe: User breakpoint.
And breaks into this code at:
BOOL CAsyncSocket::Accept(CAsyncSocket& rConnectedSocket,
SOCKADDR* lpSockAddr, int* lpSockAddrLen)
{
/// BREAK POINT HERE ---->
ASSERT(rConnectedSocket.m_hSocket == INVALID_SOCKET);
ASSERT(CAsyncSocket::FromHandle(INVALID_SOCKET) == NULL);
CAsyncSocket::AttachHandle(INVALID_SOCKET, &rConnectedSocket);
if (CAsyncSocket::FromHandle(INVALID_SOCKET) == NULL)
{
// AttachHandle Call has failed
return FALSE;
}
I just caught an OnClose error on the server end with giving a code 10053.
Right now I am not sure where to look to find the starting point of the error. Like I said it all works well 95% of the time.
m_strCardNumber = dlgInsertCard.m_strCardNumber;
if (m_strCardNumber != "0"
{//2
m_strCardNumber = "1" + m_strCardNumber;
//start code for socket
//create a default socket
m_sConnectSocket.Create();
//open connection to server
//////Problem between here -->
m_sConnectSocket.Connect(m_strIpAddy, m_iPort);
//send Card number
int iLen;
int iSent;
iLen = m_strCardNumber.GetLength();
///// and here -->
iSent = m_sConnectSocket.Send(LPCTSTR(m_strCardNumber), iLen);
//check for errors
if (iSent == SOCKET_ERROR)
When debugging I get this error message:
Unhandled exception at 0x7c2f09c5 (mfc71d.dll) in ICServer.exe: User breakpoint.
And breaks into this code at:
BOOL CAsyncSocket::Accept(CAsyncSocket& rConnectedSocket,
SOCKADDR* lpSockAddr, int* lpSockAddrLen)
{
/// BREAK POINT HERE ---->
ASSERT(rConnectedSocket.m_hSocket == INVALID_SOCKET);
ASSERT(CAsyncSocket::FromHandle(INVALID_SOCKET) == NULL);
CAsyncSocket::AttachHandle(INVALID_SOCKET, &rConnectedSocket);
if (CAsyncSocket::FromHandle(INVALID_SOCKET) == NULL)
{
// AttachHandle Call has failed
return FALSE;
}
I just caught an OnClose error on the server end with giving a code 10053.
Right now I am not sure where to look to find the starting point of the error. Like I said it all works well 95% of the time.