Dll Created In: - MFC VC 6.0
Application Exe Developed In: - VC 6.0, C# and VB.net (Applications which are using dll)
OS: - Windows XP sp2 32bit / Windows Server 2008 64 bit
.
Problem: - Facing problem in creating socket in a method from an already deployed application exe while same method is working from another exe from same environment from same location.
.
Description: - We have product component which has an exe component and from exe we invoke a method, which is defining in dll, and that dll is developed in MFC VC6.0. In the dll we have a method which downloads images from another system after making socket connection. But every time we are getting Error code 7, it is not giving desire result while same method is working from another exe from same environment from same location. And also me dll is deployed on many systems and giving proper output from same application.
.
Already Attempt: - Because error is coming on client side so what we did, we created a driver in C# which invokes same method from same environment(on client machine) using same dll and we are astonished because it worked fine there.
.
Kindly Suggest: -We are not able to figure out root cause because nothing is coming in windows event logs but what I did, for finding the problem line, I wrote logs on each line and found the exact line in application exe which is not working, actually it is not executing Create () method,I will give snippet of the code for understanding the problem because we are not finding any kind solution for it.Kindly assist us in understanding and fixing this problem.
.
Code Snippet: -
Int Initialize (LPTSTR SiteAddress, short PortId)
{
try
{
CClientTSSocket *m_pJtsSockto;
LONG lErr = m_pJtsSockto->ConnectTS(csIPAddress,PortId);
ErrorLog (0, 0, "--------ConnectTS has been called ------------","" );
}
catch(...)
{
DWORD errorCode = GetLastError();
CString errorMessage ;
errorMessage.Format("%lu",errorCode);
ErrorLog (0, 0, "Image System", (LPTSTR)(LPCTSTR)errorMessage);
return IS_ERR_WINDOWS;
}
}
Note: -CClientTSSocket extends CAsyncSocket
IS_ERR_WINDOWS is a macro error code which value I found 7.
.
LONG ConnectTS(CString strIP, UINT n_Port)
{
ErrorLog(0,0,"ConnectTS is calling Create [is going to call]","");
if(!Create())
{
ErrorLog(0,0,"ConnectTS is calling [Create not called successfully] ","");
n_Err = GetLastError();
ErrorLog(n_Err,0,"ConnectTS is calling1111111111111111Erorrrrrrrrrrrrr","");
return NET_INIT;
}
ErrorLog(0,0,"ConnectTS is calling2222222222222222222","");
if(!AsyncSelect(0))
{
n_Err = GetLastError();
return NET_INIT;
}
if(!Connect(strIP,n_Port))
{
n_Err = GetLastError();
ErrorLog(n_Err,0,"ConnectTS","");
return SERVER_NOT_CONNECTED;
}
}
Code description: -From intGETImage_MT() method we call Initialize() method and pass client machine IP and Port and there we callConnectTS() method, In this method we Create() method and finally it returns the error code as mention in macro 7.
.
Logs after running the program: -
--------ConnectTS has been called ------------
ConnectTS is calling Create [is going to call]
Image System 0
.
Note: - According to logs, problem is coming in Create method().Here 0 is errorMessage received in catch block. And from catch block it returns macro value 7. And when we run same method individually from same machine, same environment through same dll from different exe, it is working fine and we are facing any kind of problem. While same problem application was working properly earlier but now continuously it showing problem.
.
Kindly assist us to resolve the issue.